Difference between revisions of "Ruby/C3/for-and-each-Looping-Statements/Kannada"
From Script | Spoken-Tutorial
Sandhya.np14 (Talk | contribs) |
Sandhya.np14 (Talk | contribs) |
||
Line 11: | Line 11: | ||
|- | |- | ||
| 00:07 | | 00:07 | ||
− | |* | + | |* “loop” ಶಬ್ದದ ಅರ್ಥ |
|- | |- | ||
| 00:08 | | 00:08 | ||
− | |* | + | |* 'Ruby' ಯಲ್ಲಿ ವಿವಿಧ ಪ್ರಕಾರದ 'ಲೂಪ್'ಗಳು |
|- | |- | ||
| 00:11 | | 00:11 | ||
− | |* | + | |* “for” ಲೂಪ್ ನ ಬಳಕೆ |
|- | |- | ||
| 00:12 | | 00:12 | ||
− | |* | + | |* “each” ಲೂಪ್ ಕನ್ಸ್ಟ್ರಕ್ಟ್ ನ ಬಳಕೆ ಇವುಗಳನ್ನು ಕಲಿಯುವೆವು. |
|- | |- | ||
| 00:14 | | 00:14 | ||
Line 32: | Line 32: | ||
|- | |- | ||
| 00:22 | | 00:22 | ||
− | |ಈ ಟ್ಯುಟೋರಿಯಲ್ ಅನ್ನು ಅನುಸರಿಸಲು, | + | |ಈ ಟ್ಯುಟೋರಿಯಲ್ ಅನ್ನು ಅನುಸರಿಸಲು, ನೀವು ಇಂಟರ್ನೆಟ್ ನ ಸಂಪರ್ಕವನ್ನು ಹೊಂದಿರಬೇಕು. |
|- | |- |
Revision as of 16:11, 29 December 2015
Time | Narration |
00:01 | Rubyಯಲ್ಲಿ for and each Loopsಎಂಬ ಟ್ಯುಟೋರಿಯಲ್ ಗೆ ನಿಮಗೆ ಸ್ವಾಗತ. |
00:05 | ಈ ಟ್ಯುಟೋರಿಯಲ್ ನಲ್ಲಿ ನಾವು, |
00:07 | * “loop” ಶಬ್ದದ ಅರ್ಥ |
00:08 | * 'Ruby' ಯಲ್ಲಿ ವಿವಿಧ ಪ್ರಕಾರದ 'ಲೂಪ್'ಗಳು |
00:11 | * “for” ಲೂಪ್ ನ ಬಳಕೆ |
00:12 | * “each” ಲೂಪ್ ಕನ್ಸ್ಟ್ರಕ್ಟ್ ನ ಬಳಕೆ ಇವುಗಳನ್ನು ಕಲಿಯುವೆವು. |
00:14 | ಇಲ್ಲಿ ನಾವು: |
00:16 | * Ubuntu ವರ್ಷನ್ 12.04 |
00:19 | Ruby 1.9.3 ಇವುಗಳನ್ನು ಬಳಸುತ್ತಿದ್ದೇವೆ. |
00:22 | ಈ ಟ್ಯುಟೋರಿಯಲ್ ಅನ್ನು ಅನುಸರಿಸಲು, ನೀವು ಇಂಟರ್ನೆಟ್ ನ ಸಂಪರ್ಕವನ್ನು ಹೊಂದಿರಬೇಕು. |
00:25 | 'Linux' ನಲ್ಲಿ ‘ಟರ್ಮಿನಲ್’ ಮತ್ತು ’ಟೆಕ್ಸ್ಟ್ ಎಡಿಟರ್’ ಅನ್ನು ಉಪಯೋಗಿಸುವುದನ್ನು ನೀವು ತಿಳಿದಿರಬೇಕು.You must also have knowledge of Linux commands, Terminal and Text-editor. |
00:30 | ಇಲ್ಲದಿದ್ದರೆ, ಸಂಬಂಧಿತ ಟ್ಯುಟೋರಿಯಲ್ ಗಳಿಗಾಗಿ ದಯವಿಟ್ಟು ನಮ್ಮ ವೆಬ್ಸೈಟ್ ಗೆಭೆಟ್ಟಿಕೊಡಿ.If not, for relevant tutorials, please visit our website. |
00:34 | Now, let me explain what is referred to as a “loop” in Ruby. |
00:38 | A loop is a command or set of commands that are executed a fixed number of times. |
00:44 | Ruby has the following main looping statements. |
00:47 | * for |
00:48 | * each |
00:49 | * while |
00:49 | * until. |
00:50 | In this tutorial, we will learn how to use the for and each looping constructs. |
00:55 | Before we begin, please create the following folders in your home directory- |
01:02 | ttt, ruby hyphen tutorial, looping hyphen statements. |
01:07 | Please create the sub-folders as mentioned there. |
01:11 | Now we have created the requisite folders. |
01:13 | Let's move ahead. |
01:15 | The syntax of the “for” loop in Ruby is as follows: |
01:19 | for “variable” in “a collection of objects” |
01:22 | ruby code |
01:23 | end |
01:25 | Let us try to understand it with an example. |
01:28 | Create a new file in gedit as shown in the basic level Ruby tutorials |
01:32 | and name it for hyphen loop dot rb . |
01:36 | I already have a working example of the “for” loop. |
01:39 | You can type the code as we go through this example. |
01:44 | I have declared a “for” loop in this example. |
01:47 | We have a set of numbers 1 to 20. |
01:50 | We declare a variable called “i” within the “for” loop. |
01:55 | The variable “i” gets initialized to the first element in the set of numbers 1 to 20. |
02:00 | The “for” loop declaration causes the code to iterate over each element in the set 1 to 20. |
02:07 | The “puts” method declared within the “for” loop is responsible for generating the output. |
02:14 | Now, open the terminal and type: |
02:17 | ruby space for hyphen loop dot rb and see the output. |
02:22 | The output will be an array of numbers 1 to 20. |
02:26 | In this example, we declared a “for” loop for an inclusive range. |
02:31 | It included all numbers from 1 to 20. |
02:35 | Next, we shall look at implementing the “for” loop for a non-inclusive range. |
02:41 | Continue to type the next part of the code. |
02:44 | Non-inclusive means it will not include the last element in the collection of objects. |
02:49 | Here, “for” loop is implemented for a non-inclusive range of numbers 1 to 20. |
02:55 | You will notice shortly that the number 20 will not be printed in the output. |
02:59 | The last digit does not get included when you have 3 dots between numbers. |
03:04 | Now, open the terminal and type: ruby space for hyphen loop dot rb |
03:13 | and see the output. |
03:17 | The output will still be an array of numbers but will not include the number 20. |
03:22 | Now, you should be capable enough to write your own “for” loop. |
03:27 | The syntax of the “each” loop in Ruby is as follows: |
03:31 | “a collection of objects” dot each do item |
03:36 | ruby code end |
03:38 | Let us try to understand it with an example. |
03:42 | Create a new file in gedit as shown in the basic level Ruby tutorials |
03:46 | and name it each hyphen loop dot rb. |
03:50 | I already have a working example of the each loop. |
03:53 | You can type the code as we go through this example. |
03:58 | I have declared an each loop in this example. |
04:03 | We have a set of numbers 1 to 20. |
04:06 | We declare a variable called “i” within the each loop. |
04:11 | The “i” variable gets initialized to the first element in the set of numbers 1 to 20. |
04:17 | The each loop declaration causes the code to iterate over each element in the set 1 to 20. |
04:23 | The puts method declared, within the each, is responsible for generating the output. |
04:30 | Now, open the terminal and type: ruby space each hyphen loop dot rb |
04:39 | and see the output. |
04:43 | The output will be an array of numbers 1 to 20. |
04:46 | In the above example, we declared an each loop for an inclusive range. |
04:51 | It included all numbers from 1 to 20. |
04:54 | Next we shall look at implementing the each loop for a non-inclusive range. |
05:00 | Continue to type this part of the code. |
05:04 | Non-inclusive means it will not include the last element in the collection of objects. |
05:10 | Here an each loop is implemented for a non-inclusive range of numbers 1 to 20. |
05:16 | You will notice shortly that the number 20 will not be printed in the output. |
05:20 | The last digit does not get included when you have 3 dots between numbers. |
05:25 | Now, open the terminal and type: ruby space each hyphen loop dot rb |
05:34 | and see the output. |
05:39 | Now you should be capable enough to write your own each loop. |
05:44 | How would we determine which looping construct to choose? |
05:48 | Let us try to recall the "for" loop construct. |
05:53 | In the first example, we iterated over a set of numbers from 1 to 20 using for. |
05:59 | Execute: ruby space for hyphen loop dot rb in your terminal see the output. |
06:08 | Now, look at the code in gedit. |
06:11 | When you invoke the for loop, Ruby is actually calling the each method behind the scenes. |
06:16 | And, calling each or for will generate the same output. |
06:21 | Since the call to for in turn calls each, it is preferable to use the each loop instead. |
06:28 | ಇದರೊಂದಿಗೆ ನಾವು ಈ ಸ್ಪೋಕನ್ ಟ್ಯುಟೋರಿಯಲ್ ನ ಕೊನೆಗೆ ಬಂದಿರುತ್ತೇವೆ. |
06:30 | ಸಂಕ್ಷಿಪ್ತವಾಗಿ, |
06:32 | ಈ ಟ್ಯುಟೋರಿಯಲ್ ನಲ್ಲಿ ನಾವು, we have learnt: |
06:33 | * Usage of for loop |
06:35 | * Usage of each construct |
06:38 | * Reasoning behind using each instead of for |
06:41 | * Examples of using the above looping constructs. ಕಲಿತಿದ್ದೇವೆ. |
06:45 | ಒಂದು ಅಸೈನ್ಮೆಂಟ್- |
06:47 | Write a ruby program using the appropriate loop construct |
06:50 | to create an output of even numbers from a set of numbers, say 1 to 20. |
06:56 | ಈ ಕೆಳಗಿನ ಲಿಂಕ್ ನಲ್ಲಿ ಲಭ್ಯವಿರುವ ವೀಡಿಯೋವನ್ನು ವೀಕ್ಷಿಸಿ. |
07:00 | ಇದು “ಸ್ಪೋಕನ್ ಟ್ಯುಟೋರಿಯಲ್” ಪ್ರಕಲ್ಪದ ಸಾರಾಂಶವಾಗಿದೆ. |
07:03 | ನಿಮಗೆ ಒಳ್ಳೆಯ ‘ಬ್ಯಾಂಡ್ವಿಡ್ತ್’ ಸಿಗದಿದ್ದರೆ, ನೀವು ಇದನ್ನು ಡೌನ್ಲೋಡ್ ಮಾಡಿ ನೋಡಬಹುದು. |
07:08 | “ಸ್ಪೋಕನ್ ಟ್ಯುಟೋರಿಯಲ್” ಪ್ರಕಲ್ಪದ ತಂಡವು: |
07:11 | * ‘ಸ್ಪೋಕನ್ ಟ್ಯುಟೋರಿಯಲ್’ಗಳನ್ನು ಬಳಸಿ ಕಾರ್ಯಶಾಲೆಗಳನ್ನು ನಡೆಸುತ್ತದೆ. |
07:14 | * ಆನ್-ಲೈನ್ ಪರೀಕ್ಷೆಯಲ್ಲಿ ಉತ್ತೀರ್ಣರಾದವರಿಗೆ ಪ್ರಮಾಣಪತ್ರವನ್ನು ಕೊಡುತ್ತದೆ. |
07:18 | ಹೆಚ್ಚಿನ ಮಾಹಿತಿಗಾಗಿ, ದಯವಿಟ್ಟು ಈ ಲಿಂಕ್ ಗೆ ಬರೆಯಿರಿ:
contact@spoken-tutorial.org |
07:23 | "ಸ್ಪೋಕನ್ ಟ್ಯುಟೋರಿಯಲ್” ಪ್ರಕಲ್ಪವು “ಟಾಕ್ ಟು ಎ ಟೀಚರ್” ಪ್ರಕಲ್ಪದ ಒಂದು ಭಾಗವಾಗಿದೆ. |
07:26 | ಇದು ICT, MHRD ಮೂಲಕ ರಾಷ್ಟ್ರೀಯ ಸಾಕ್ಷರತಾ ಮಿಷನ್, ಭಾರತ ಸರ್ಕಾರದ ಆಧಾರವನ್ನು ಪಡೆದಿದೆ. |
07:33 | ಈ ಮಿಷನ್ ನ ಬಗ್ಗೆ ಹೆಚ್ಚಿನ ಮಾಹಿತಿಯು ಈ ಕೆಳಗಿನ ಲಿಂಕ್ ನಲ್ಲಿ ಲಭ್ಯವಿರುತ್ತದೆ:
spoken hyphen tutorial dot org slash NMEICT hyphen Intro. |
07:41 | IIT Bombay ಯಿಂದ, ಸ್ಕ್ರಿಪ್ಟ್ ನ ಅನುವಾದಕಿ ಸಂಧ್ಯಾ ಪುಣೇಕರ್ ಹಾಗೂ ಪ್ರವಾಚಕ ------ . ವಂದನೆಗಳು. |