Difference between revisions of "Ruby/C2/Hello-Ruby/English-timed"

From Script | Spoken-Tutorial
Jump to: navigation, search
m
Line 1: Line 1:
 
{| border=1
 
{| border=1
|| ''Time'''
+
| ''Time'''
|| '''Narration'''
+
|'''Narration'''
  
  
 
|-
 
|-
|00.00
+
|00:00
 
|Welcome to the Spoken Tutorial on  '''Hello''' '''Ruby'''!  
 
|Welcome to the Spoken Tutorial on  '''Hello''' '''Ruby'''!  
  
 
|-
 
|-
|  00.04
+
|  00:04
 
|  In this tutorial we will learn  
 
|  In this tutorial we will learn  
  
 
|-
 
|-
|  00.06
+
|  00:06
 
| What is '''Ruby'''?
 
| What is '''Ruby'''?
  
 
|-
 
|-
|  00.08
+
|  00:08
 
|  Features
 
|  Features
  
 
|-  
 
|-  
|  00.09
+
|  00:09
 
|  '''RubyGems''' &  ''' Help on Ruby'''
 
|  '''RubyGems''' &  ''' Help on Ruby'''
  
 
|-
 
|-
| 00.12  
+
| 00:12  
 
|  Installation
 
|  Installation
  
 
|-
 
|-
|  00.13
+
|  00:13
 
|  Running '''Ruby''' code
 
|  Running '''Ruby''' code
  
 
|-
 
|-
|  00.15
+
|  00:15
 
|  Commenting
 
|  Commenting
  
 
|-
 
|-
|  00.16
+
|  00:16
 
|  Difference between '''puts''' and '''print'''  
 
|  Difference between '''puts''' and '''print'''  
  
 
|-
 
|-
|  00.19
+
|  00:19
 
|  Here we are using  '''Ubuntu Linux '''version 12.04  '''Ruby''' 1.9.3
 
|  Here we are using  '''Ubuntu Linux '''version 12.04  '''Ruby''' 1.9.3
  
 
|-
 
|-
|  00.27
+
|  00:27
 
|  To follow this tutorial you must be connected to  internet.  
 
|  To follow this tutorial you must be connected to  internet.  
  
 
|-
 
|-
|  00.30
+
|  00:30
 
| You must have knowledge of using '''Terminal '''and '''Text editor '''in '''Linux'''.  
 
| You must have knowledge of using '''Terminal '''and '''Text editor '''in '''Linux'''.  
  
 
|-
 
|-
|  00.37
+
|  00:37
 
|  Now I will explain what is '''Ruby'''.
 
|  Now I will explain what is '''Ruby'''.
  
 
|-
 
|-
|  00.40
+
|  00:40
 
|  '''Ruby''' is an object-oriented, interpreted scripting language.  
 
|  '''Ruby''' is an object-oriented, interpreted scripting language.  
  
 
|-
 
|-
|  00.44
+
|  00:44
 
|  It is dynamic, open source programming language.   
 
|  It is dynamic, open source programming language.   
  
 
|-
 
|-
|  00.48
+
|  00:48
 
|  It has an elegant syntax that is natural to read and easy to write.  
 
|  It has an elegant syntax that is natural to read and easy to write.  
  
Line 71: Line 71:
  
 
|-
 
|-
| 00.54
+
| 00:54
 
|  Now let us see some features of '''Ruby'''.
 
|  Now let us see some features of '''Ruby'''.
  
  
 
|-
 
|-
|  00.57
+
|  00:57
 
|  '''Ruby''' is highly portable.  
 
|  '''Ruby''' is highly portable.  
  
 
|-
 
|-
|  00.59
+
|  00:59
 
| '''Ruby''' program runs in any operating system.
 
| '''Ruby''' program runs in any operating system.
  
 
|-
 
|-
|  01.04
+
|  01:04
 
|  Variables in '''Ruby''' have no datatype, such as in '''Smalltalk, BASIC''' or '''Python'''.
 
|  Variables in '''Ruby''' have no datatype, such as in '''Smalltalk, BASIC''' or '''Python'''.
  
 
|-
 
|-
|  01.11
+
|  01:11
 
|  It supports automatic memory management.
 
|  It supports automatic memory management.
  
 
|-
 
|-
|  01.14
+
|  01:14
 
|  '''Ruby''' is free format language.
 
|  '''Ruby''' is free format language.
  
 
|-
 
|-
|  01.17
+
|  01:17
 
|  You can start writing your program from any line and column.
 
|  You can start writing your program from any line and column.
  
 
|-
 
|-
|  01.21
+
|  01:21
 
|  '''Ruby''' is used for developing Internet and Intra-net applications.
 
|  '''Ruby''' is used for developing Internet and Intra-net applications.
  
Line 106: Line 106:
  
 
|-
 
|-
| 01.26
+
| 01:26
 
| One of the most important feature of '''Ruby''' is '''RubyGems'''.
 
| One of the most important feature of '''Ruby''' is '''RubyGems'''.
  
  
 
|-
 
|-
| 01.31  
+
| 01:31  
 
| '''RubyGems''' is a package manager for  '''Ruby''' programming language.
 
| '''RubyGems''' is a package manager for  '''Ruby''' programming language.
  
  
 
|-
 
|-
|  01.36
+
|  01:36
 
| It provides a standard format for distributing''' Ruby''' programs and libraries.
 
| It provides a standard format for distributing''' Ruby''' programs and libraries.
  
  
 
|-
 
|-
|  01.42
+
|  01:42
 
| You can create and publish your own '''gems. '''
 
| You can create and publish your own '''gems. '''
  
 
|-
 
|-
|  01.46
+
|  01:46
 
| For more information on '''RubyGems''' visit the following link.
 
| For more information on '''RubyGems''' visit the following link.
  
Line 132: Line 132:
  
 
|-
 
|-
|  01.51
+
|  01:51
 
|  To get more help on '''Ruby''' you can visit the links shown.
 
|  To get more help on '''Ruby''' you can visit the links shown.
  
 
|-
 
|-
|  01.55
+
|  01:55
 
| You can install '''Ruby '''using the '''Ubuntu Software Centre'''.
 
| You can install '''Ruby '''using the '''Ubuntu Software Centre'''.
  
 
|-
 
|-
|  01.59
+
|  01:59
 
| For more information on '''Ubuntu Software Centre''', please refer to the Ubuntu Linux Tutorials on this website.
 
| For more information on '''Ubuntu Software Centre''', please refer to the Ubuntu Linux Tutorials on this website.
  
  
 
|-
 
|-
|  02.07
+
|  02:07
 
|  Other methods for installing '''Ruby '''are as shown in this slide.
 
|  Other methods for installing '''Ruby '''are as shown in this slide.
  
 
|-
 
|-
|  02.12
+
|  02:12
 
| 'Ruby code '''can be executed in 3 ways
 
| 'Ruby code '''can be executed in 3 ways
  
 
|-
 
|-
|  02.16
+
|  02:16
 
|  '''Command line '''
 
|  '''Command line '''
 
|-
 
|-
|  02.17
+
|  02:17
 
|  '''Interactive Ruby'''
 
|  '''Interactive Ruby'''
 
|-
 
|-
|  02.19
+
|  02:19
 
|  As a '''file''  
 
|  As a '''file''  
  
  
 
|-
 
|-
|  02.20
+
|  02:20
 
| We will go through each method of execution.
 
| We will go through each method of execution.
  
  
 
|-
 
|-
|  02.23
+
|  02:23
 
|  First let us see how to execute the  '''Hello World''' code from  command line.
 
|  First let us see how to execute the  '''Hello World''' code from  command line.
  
 
|-
 
|-
|  02.28
+
|  02:28
 
| Open a terminal by pressing the '''Ctrl, Alt and T '''keys simultaneously.  
 
| Open a terminal by pressing the '''Ctrl, Alt and T '''keys simultaneously.  
  
  
 
|-
 
|-
|  02.33
+
|  02:33
 
| A terminal window appears on your screen.
 
| A terminal window appears on your screen.
  
 
|-
 
|-
| 02.37
+
| 02:37
 
|  Type the command
 
|  Type the command
  
 
|-
 
|-
|  02.38
+
|  02:38
 
| '''ruby '''''space''''' ''hyphen ''e '''''space'' within single quotes '''puts '''space''' '''then within double quotes''' Hello World''' and
 
| '''ruby '''''space''''' ''hyphen ''e '''''space'' within single quotes '''puts '''space''' '''then within double quotes''' Hello World''' and
  
  
 
|-
 
|-
|  02.50
+
|  02:50
 
| Press '''Enter.'''
 
| Press '''Enter.'''
  
 
|-
 
|-
|  02.53
+
|  02:53
 
|  We get the output as '''Hello World.'''
 
|  We get the output as '''Hello World.'''
  
 
|-
 
|-
| 02.56
+
| 02:56
 
|  '''puts '''command''' '''is used to print the output on the '''terminal.'''
 
|  '''puts '''command''' '''is used to print the output on the '''terminal.'''
  
 
|-
 
|-
| 03.00
+
| 03:00
 
|  The'' hyphen'' '''e flag '''allows only a single line of code to be executed.
 
|  The'' hyphen'' '''e flag '''allows only a single line of code to be executed.
  
 
|-
 
|-
|  03.06
+
|  03:06
 
| Multiple''' '''''hyphen''''' e flags''' can be used to execute multiple line commands.  
 
| Multiple''' '''''hyphen''''' e flags''' can be used to execute multiple line commands.  
  
  
 
|-
 
|-
|  03.11
+
|  03:11
 
| Lets try this out
 
| Lets try this out
  
 
|-
 
|-
|  03.13
+
|  03:13
 
|  Now press the up Arrow key to get the previous command and  
 
|  Now press the up Arrow key to get the previous command and  
  
 
|-
 
|-
|  03.18
+
|  03:18
 
|  Type ''space''' hyphen ''e '''''space ''within'' ''single quotes '''puts '''space '''1+2 '''and
 
|  Type ''space''' hyphen ''e '''''space ''within'' ''single quotes '''puts '''space '''1+2 '''and
  
  
 
|-
 
|-
|  03.30
+
|  03:30
 
| Press''' Enter.'''
 
| Press''' Enter.'''
  
 
|-
 
|-
|  03.32
+
|  03:32
 
|  We get the output as '''Hello World '''and''' 3.'''
 
|  We get the output as '''Hello World '''and''' 3.'''
  
  
 
|-
 
|-
|  03.36   
+
|  03:36   
 
| Let's switch back to our slide
 
| Let's switch back to our slide
  
 
|-
 
|-
|  03.38
+
|  03:38
 
|We will now learn about '''Interactive Ruby.'''
 
|We will now learn about '''Interactive Ruby.'''
  
  
 
|-
 
|-
|  03.42
+
|  03:42
 
| '''Interactive Ruby '''allows the execution of '''Ruby''' commands with immediate response.
 
| '''Interactive Ruby '''allows the execution of '''Ruby''' commands with immediate response.
  
  
 
|-
 
|-
|  03.48
+
|  03:48
 
| You can run '''Ruby''' statements and examine the output and return values.
 
| You can run '''Ruby''' statements and examine the output and return values.
  
  
 
|-
 
|-
|  03.53
+
|  03:53
 
| For older version of '''Ruby,''' install '''irb''' separately.
 
| For older version of '''Ruby,''' install '''irb''' separately.
  
 
|-
 
|-
|  03.57
+
|  03:57
 
| Now let us execute our '''Ruby''' code through '''irb.''' Go to the terminal  
 
| Now let us execute our '''Ruby''' code through '''irb.''' Go to the terminal  
  
  
 
|-
 
|-
|  04.03
+
|  04:03
 
| Type'''irb '''and Press '''Enter'''  
 
| Type'''irb '''and Press '''Enter'''  
  
 
|-
 
|-
|  04.06
+
|  04:06
 
| to launch the '''Interactive Ruby'''  
 
| to launch the '''Interactive Ruby'''  
  
 
|-
 
|-
| 04.09
+
| 04:09
 
| Type '''puts ''' space within double quotes '''Hello World''' and press '''Enter.'''
 
| Type '''puts ''' space within double quotes '''Hello World''' and press '''Enter.'''
  
 
|-
 
|-
| 04.19
+
| 04:19
 
|We get the output as '''Hello World.'''
 
|We get the output as '''Hello World.'''
  
 
|-
 
|-
|  04.22
+
|  04:22
 
|  And We get the return value as '''nil.'''
 
|  And We get the return value as '''nil.'''
  
  
 
|-
 
|-
| 04.25
+
| 04:25
 
|  To''' '''exit from '''irb '''type '''exit''' and press '''Enter.'''
 
|  To''' '''exit from '''irb '''type '''exit''' and press '''Enter.'''
  
 
|-
 
|-
| 04.31
+
| 04:31
 
|  You can also run '''Ruby program''' from a file.
 
|  You can also run '''Ruby program''' from a file.
  
  
 
|-
 
|-
|  04.34
+
|  04:34
 
| You can use any text editor of your choice to write the code.
 
| You can use any text editor of your choice to write the code.
  
 
|-
 
|-
|  04.39
+
|  04:39
 
|  I am using '''gedit '''text editor'''. Let me switch to  '''gedit''' text editor
 
|  I am using '''gedit '''text editor'''. Let me switch to  '''gedit''' text editor
  
 
|-
 
|-
| 04.45
+
| 04:45
 
|  Now, type '''puts''' space within double quotes''' Hello World '''
 
|  Now, type '''puts''' space within double quotes''' Hello World '''
  
 
|-
 
|-
|  04.54
+
|  04:54
 
| Lets learn how to add multiple line or block '''comments'''.
 
| Lets learn how to add multiple line or block '''comments'''.
  
 
|-
 
|-
|  04.59
+
|  04:59
 
|  Before the '''puts '''command
 
|  Before the '''puts '''command
  
 
|-
 
|-
|  05.01
+
|  05:01
 
| Type, ''equal to '''''begin '''and press '''Enter'''
 
| Type, ''equal to '''''begin '''and press '''Enter'''
  
 
|-
 
|-
|  05.06
+
|  05:06
 
| 'Equal to '''''begin '''is used to start the comment.
 
| 'Equal to '''''begin '''is used to start the comment.
  
 
|-
 
|-
| 05.10
+
| 05:10
 
|  Type the comments that you wish to add.
 
|  Type the comments that you wish to add.
  
  
 
|-
 
|-
|  05.13
+
|  05:13
 
| I will type '''My first Ruby program '''
 
| I will type '''My first Ruby program '''
  
 
|-
 
|-
|  05.20
+
|  05:20
 
| and Press '''Enter'''
 
| and Press '''Enter'''
  
 
|-
 
|-
|  05.22
+
|  05:22
 
| Then type '''This code will print helloworld''' and '''Press Enter'''
 
| Then type '''This code will print helloworld''' and '''Press Enter'''
  
 
|-
 
|-
|  05.30
+
|  05:30
 
|  Now type ''equal to '''''end'''
 
|  Now type ''equal to '''''end'''
  
 
|-
 
|-
| 05.32
+
| 05:32
 
| ''equal to '''''end '''is used to end the multiple line''' comments.'''
 
| ''equal to '''''end '''is used to end the multiple line''' comments.'''
  
 
|-
 
|-
| 05.37
+
| 05:37
 
|  '''Comments''' are useful to understand the flow of program.
 
|  '''Comments''' are useful to understand the flow of program.
  
 
|-
 
|-
|  05.41
+
|  05:41
 
| It is useful for documentation.
 
| It is useful for documentation.
  
 
|-
 
|-
|  05.45
+
|  05:45
 
| Now, let us '''save''' the '''file''' by clicking on the '''Save '''button.  
 
| Now, let us '''save''' the '''file''' by clicking on the '''Save '''button.  
  
  
 
|-
 
|-
| 05.50  
+
| 05:50  
 
| It is a good practice to '''save''' the file frequently.
 
| It is a good practice to '''save''' the file frequently.
  
 
|-
 
|-
| 05.53
+
| 05:53
 
|  The '''Save As '''dialog box''' '''appears on your screen.  
 
|  The '''Save As '''dialog box''' '''appears on your screen.  
  
 
|-
 
|-
|  05.57
+
|  05:57
 
| Browse the location where you want to save the file.  
 
| Browse the location where you want to save the file.  
  
 
|-
 
|-
|  06.01
+
|  06:01
 
|  On 'Desktop, '''I will create a folder named '''rubyprogram'''.  
 
|  On 'Desktop, '''I will create a folder named '''rubyprogram'''.  
  
  
 
|-
 
|-
|  06.06
+
|  06:06
 
| We will save the file inside this folder.  
 
| We will save the file inside this folder.  
  
 
|-
 
|-
| 06.10
+
| 06:10
 
|  In the '''Name''' text-box, type the name that you wish to add.  
 
|  In the '''Name''' text-box, type the name that you wish to add.  
  
 
|-
 
|-
|  06.14
+
|  06:14
 
| I will type '''hello.rb'''
 
| I will type '''hello.rb'''
  
 
|-
 
|-
|  06.17
+
|  06:17
 
|  '''Dot rb''' extension is given to a '''Ruby '''file
 
|  '''Dot rb''' extension is given to a '''Ruby '''file
  
 
|-
 
|-
|  06.21
+
|  06:21
 
|  Then click on '''Save '''button to save the file.  So the file is saved now.  
 
|  Then click on '''Save '''button to save the file.  So the file is saved now.  
  
 
|-
 
|-
|  06.28
+
|  06:28
 
|  To execute the code, go to the '''terminal.'''
 
|  To execute the code, go to the '''terminal.'''
  
 
|-
 
|-
|  06.32
+
|  06:32
 
| Lets clear the terminal first.
 
| Lets clear the terminal first.
  
 
|-
 
|-
|  06.35
+
|  06:35
 
|  Make sure that you are in the directory where your '''Ruby '''file is present.
 
|  Make sure that you are in the directory where your '''Ruby '''file is present.
  
 
|-
 
|-
|  06.39  
+
|  06:39  
 
|  Remember that we are in the '''home '''directory. We need to go to the subdirectory '''rubyprogram'''.
 
|  Remember that we are in the '''home '''directory. We need to go to the subdirectory '''rubyprogram'''.
  
 
|-
 
|-
|  06.47
+
|  06:47
 
| To do so, type '''cd''' space '''Desktop/rubyprogram''' and press '''Enter.'''  
 
| To do so, type '''cd''' space '''Desktop/rubyprogram''' and press '''Enter.'''  
  
 
|-
 
|-
|  07.00
+
|  07:00
 
|  Let's execute the file . Type '''ruby space hello dot rb''' and press '''Enter'''
 
|  Let's execute the file . Type '''ruby space hello dot rb''' and press '''Enter'''
  
 
|-
 
|-
| 07.10
+
| 07:10
 
| We get the output '''HelloWorld.'''
 
| We get the output '''HelloWorld.'''
  
 
|-
 
|-
|  07.13
+
|  07:13
 
|  Now let me demonstrate the difference between '''puts''' and '''print '''statement.
 
|  Now let me demonstrate the difference between '''puts''' and '''print '''statement.
  
  
 
|-
 
|-
|  07.18
+
|  07:18
 
| We will try this out using''' irb'''
 
| We will try this out using''' irb'''
  
 
|-
 
|-
|  07.22
+
|  07:22
 
|  Before that we need to go back to the home directory.To do so type '''cd '''and press '''Enter'''
 
|  Before that we need to go back to the home directory.To do so type '''cd '''and press '''Enter'''
  
 
|-
 
|-
|  07.31
+
|  07:31
 
|Now type '''irb''' and Press Enter''' to launch the '''Interactive Ruby.'''
 
|Now type '''irb''' and Press Enter''' to launch the '''Interactive Ruby.'''
  
 
|-
 
|-
|  07.39
+
|  07:39
 
|  Type '''puts '''space within double quotes '''Hello '''comma within double quotes '''World '''
 
|  Type '''puts '''space within double quotes '''Hello '''comma within double quotes '''World '''
  
 
|-
 
|-
|  07.50
+
|  07:50
 
| Here''' comma '''is used to join the two '''puts''' command together.
 
| Here''' comma '''is used to join the two '''puts''' command together.
  
 
|-
 
|-
|  07.55
+
|  07:55
 
| Now press '''Enter.'''
 
| Now press '''Enter.'''
  
 
|-
 
|-
|  07.57
+
|  07:57
 
|  We get the output '''Hello World,''' but on separate lines.
 
|  We get the output '''Hello World,''' but on separate lines.
  
 
|-
 
|-
| 08.03
+
| 08:03
 
|  Now let's try the same thing with '''print.'''
 
|  Now let's try the same thing with '''print.'''
  
  
 
|-
 
|-
|  08.06
+
|  08:06
 
| Press up arrow key to get the previous command
 
| Press up arrow key to get the previous command
  
 
|-
 
|-
|  08.09
+
|  08:09
 
| Replace puts with print and  Press '''Enter.'''
 
| Replace puts with print and  Press '''Enter.'''
  
 
|-
 
|-
|  08.14
+
|  08:14
 
|  We get the output as '''Hello World '''but on the same line.
 
|  We get the output as '''Hello World '''but on the same line.
  
 
|-
 
|-
|  08.19
+
|  08:19
 
|  The keyword '''puts''' adds a newline to the end of the output. The keyword''' print '''does not.
 
|  The keyword '''puts''' adds a newline to the end of the output. The keyword''' print '''does not.
  
 
|-
 
|-
|  08.27
+
|  08:27
 
|  The keyword''' print '''outputs only what we have provided.
 
|  The keyword''' print '''outputs only what we have provided.
  
 
|-
 
|-
|  08.31
+
|  08:31
 
|    This brings us to the end of this Spoken Tutorial. Let us switch back to our slides.
 
|    This brings us to the end of this Spoken Tutorial. Let us switch back to our slides.
  
 
|-
 
|-
|  08.37
+
|  08:37
 
|  In this tutorial we have learnt
 
|  In this tutorial we have learnt
  
 
|-
 
|-
|  08.39
+
|  08:39
 
|  About '''Ruby'''
 
|  About '''Ruby'''
 
|-
 
|-
|  08.41
+
|  08:41
 
|  Installation
 
|  Installation
 
|-
 
|-
|  08.42
+
|  08:42
 
|  Execution of '''Ruby '''code  
 
|  Execution of '''Ruby '''code  
 
|-
 
|-
|  08.44
+
|  08:44
 
| Adding multiple comments using  =begin and  =end
 
| Adding multiple comments using  =begin and  =end
  
  
 
|-
 
|-
|  08.50
+
|  08:50
 
| Difference between '''puts''' and '''print'''
 
| Difference between '''puts''' and '''print'''
  
Line 509: Line 509:
  
 
|-
 
|-
|  08.53
+
|  08:53
 
| As an assignment
 
| As an assignment
  
 
|-
 
|-
| 08.55  
+
| 08:55  
 
| Write a program to print your name and age  
 
| Write a program to print your name and age  
  
 
|-
 
|-
|  08.58
+
|  08:58
 
| We used '''multiple line comments''' in this tutorial  
 
| We used '''multiple line comments''' in this tutorial  
  
 
|-
 
|-
|  09.01
+
|  09:01
 
| Try to give '''single line comment'''  
 
| Try to give '''single line comment'''  
  
 
   
 
   
 
|-
 
|-
|  09.04
+
|  09:04
 
| Watch the video available at the following link.
 
| Watch the video available at the following link.
  
  
 
|-
 
|-
|  09.07
+
|  09:07
 
| It summarises the Spoken Tutorial project.
 
| It summarises the Spoken Tutorial project.
  
 
|-
 
|-
|  09.10
+
|  09:10
 
| If you do not have good bandwidth, you can download and watch it.  
 
| If you do not have good bandwidth, you can download and watch it.  
  
 
|-
 
|-
|  09.15
+
|  09:15
 
|  The Spoken Tutorial Project Team :
 
|  The Spoken Tutorial Project Team :
  
  
 
|-
 
|-
|  09.17
+
|  09:17
 
| Conducts workshops using spoken tutorials  
 
| Conducts workshops using spoken tutorials  
  
 
|-
 
|-
|  09.20
+
|  09:20
 
| Gives certificates to those who pass an online test  
 
| Gives certificates to those who pass an online test  
  
 
|-
 
|-
|  09.24
+
|  09:24
 
| For more details, please write to contact@spoken-tutorial.org
 
| For more details, please write to contact@spoken-tutorial.org
  
 
|-
 
|-
|  09.30
+
|  09:30
 
|  Spoken Tutorial Project is a part of Talk to a Teacher project.
 
|  Spoken Tutorial Project is a part of Talk to a Teacher project.
  
 
|-
 
|-
|  09.34
+
|  09:34
 
| It is supported by the National Mission on Education through ICT, MHRD, Government of India.
 
| It is supported by the National Mission on Education through ICT, MHRD, Government of India.
  
 
|-
 
|-
|  09.41
+
|  09:41
 
| More information on this Mission is available at below link
 
| More information on this Mission is available at below link
  
 
|-
 
|-
| 09.45  
+
| 09:45  
 
| This is Afrin Pinjari from IIT Bombay, signing off.
 
| This is Afrin Pinjari from IIT Bombay, signing off.
  
 
|-
 
|-
|  09.50
+
|  09:50
 
| Thank you for watching.
 
| Thank you for watching.
  
 
|}
 
|}

Revision as of 15:04, 10 July 2014

Time' Narration


00:00 Welcome to the Spoken Tutorial on Hello Ruby!
00:04 In this tutorial we will learn
00:06 What is Ruby?
00:08 Features
00:09 RubyGems & Help on Ruby
00:12 Installation
00:13 Running Ruby code
00:15 Commenting
00:16 Difference between puts and print
00:19 Here we are using Ubuntu Linux version 12.04 Ruby 1.9.3
00:27 To follow this tutorial you must be connected to internet.
00:30 You must have knowledge of using Terminal and Text editor in Linux.
00:37 Now I will explain what is Ruby.
00:40 Ruby is an object-oriented, interpreted scripting language.
00:44 It is dynamic, open source programming language.
00:48 It has an elegant syntax that is natural to read and easy to write.


00:54 Now let us see some features of Ruby.


00:57 Ruby is highly portable.
00:59 Ruby program runs in any operating system.
01:04 Variables in Ruby have no datatype, such as in Smalltalk, BASIC or Python.
01:11 It supports automatic memory management.
01:14 Ruby is free format language.
01:17 You can start writing your program from any line and column.
01:21 Ruby is used for developing Internet and Intra-net applications.


01:26 One of the most important feature of Ruby is RubyGems.


01:31 RubyGems is a package manager for Ruby programming language.


01:36 It provides a standard format for distributing Ruby programs and libraries.


01:42 You can create and publish your own gems.
01:46 For more information on RubyGems visit the following link.



01:51 To get more help on Ruby you can visit the links shown.
01:55 You can install Ruby using the Ubuntu Software Centre.
01:59 For more information on Ubuntu Software Centre, please refer to the Ubuntu Linux Tutorials on this website.


02:07 Other methods for installing Ruby are as shown in this slide.
02:12 'Ruby code can be executed in 3 ways
02:16 Command line
02:17 Interactive Ruby
02:19 As a 'file


02:20 We will go through each method of execution.


02:23 First let us see how to execute the Hello World code from command line.
02:28 Open a terminal by pressing the Ctrl, Alt and T keys simultaneously.


02:33 A terminal window appears on your screen.
02:37 Type the command
02:38 ruby space hyphen e space within single quotes puts space then within double quotes Hello World and


02:50 Press Enter.
02:53 We get the output as Hello World.
02:56 puts command is used to print the output on the terminal.
03:00 The hyphen e flag allows only a single line of code to be executed.
03:06 Multiple hyphen e flags can be used to execute multiple line commands.


03:11 Lets try this out
03:13 Now press the up Arrow key to get the previous command and
03:18 Type space hyphen e space within single quotes puts space 1+2 and


03:30 Press Enter.
03:32 We get the output as Hello World and 3.


03:36 Let's switch back to our slide
03:38 We will now learn about Interactive Ruby.


03:42 Interactive Ruby allows the execution of Ruby commands with immediate response.


03:48 You can run Ruby statements and examine the output and return values.


03:53 For older version of Ruby, install irb separately.
03:57 Now let us execute our Ruby code through irb. Go to the terminal


04:03 Typeirb and Press Enter
04:06 to launch the Interactive Ruby
04:09 Type puts space within double quotes Hello World and press Enter.
04:19 We get the output as Hello World.
04:22 And We get the return value as nil.


04:25 To exit from irb type exit and press Enter.
04:31 You can also run Ruby program from a file.


04:34 You can use any text editor of your choice to write the code.
04:39 I am using gedit text editor. Let me switch to gedit text editor
04:45 Now, type puts space within double quotes Hello World
04:54 Lets learn how to add multiple line or block comments.
04:59 Before the puts command
05:01 Type, equal to begin and press Enter
05:06 'Equal to begin is used to start the comment.
05:10 Type the comments that you wish to add.


05:13 I will type My first Ruby program
05:20 and Press Enter
05:22 Then type This code will print helloworld and Press Enter
05:30 Now type equal to end
05:32 equal to end is used to end the multiple line comments.
05:37 Comments are useful to understand the flow of program.
05:41 It is useful for documentation.
05:45 Now, let us save the file by clicking on the Save button.


05:50 It is a good practice to save the file frequently.
05:53 The Save As dialog box appears on your screen.
05:57 Browse the location where you want to save the file.
06:01 On 'Desktop, I will create a folder named rubyprogram.


06:06 We will save the file inside this folder.
06:10 In the Name text-box, type the name that you wish to add.
06:14 I will type hello.rb
06:17 Dot rb extension is given to a Ruby file
06:21 Then click on Save button to save the file. So the file is saved now.
06:28 To execute the code, go to the terminal.
06:32 Lets clear the terminal first.
06:35 Make sure that you are in the directory where your Ruby file is present.
06:39 Remember that we are in the home directory. We need to go to the subdirectory rubyprogram.
06:47 To do so, type cd space Desktop/rubyprogram and press Enter.
07:00 Let's execute the file . Type ruby space hello dot rb and press Enter
07:10 We get the output HelloWorld.
07:13 Now let me demonstrate the difference between puts and print statement.


07:18 We will try this out using irb
07:22 Before that we need to go back to the home directory.To do so type cd and press Enter
07:31 Now type irb and Press Enter to launch the Interactive Ruby.
07:39 Type puts space within double quotes Hello comma within double quotes World
07:50 Here comma is used to join the two puts command together.
07:55 Now press Enter.
07:57 We get the output Hello World, but on separate lines.
08:03 Now let's try the same thing with print.


08:06 Press up arrow key to get the previous command
08:09 Replace puts with print and Press Enter.
08:14 We get the output as Hello World but on the same line.
08:19 The keyword puts adds a newline to the end of the output. The keyword print does not.
08:27 The keyword print outputs only what we have provided.
08:31 This brings us to the end of this Spoken Tutorial. Let us switch back to our slides.
08:37 In this tutorial we have learnt
08:39 About Ruby
08:41 Installation
08:42 Execution of Ruby code
08:44 Adding multiple comments using =begin and =end


08:50 Difference between puts and print


08:53 As an assignment
08:55 Write a program to print your name and age
08:58 We used multiple line comments in this tutorial
09:01 Try to give single line comment


09:04 Watch the video available at the following link.


09:07 It summarises the Spoken Tutorial project.
09:10 If you do not have good bandwidth, you can download and watch it.
09:15 The Spoken Tutorial Project Team :


09:17 Conducts workshops using spoken tutorials
09:20 Gives certificates to those who pass an online test
09:24 For more details, please write to contact@spoken-tutorial.org
09:30 Spoken Tutorial Project is a part of Talk to a Teacher project.
09:34 It is supported by the National Mission on Education through ICT, MHRD, Government of India.
09:41 More information on this Mission is available at below link
09:45 This is Afrin Pinjari from IIT Bombay, signing off.
09:50 Thank you for watching.

Contributors and Content Editors

Devraj, PoojaMoolya, Pratik kamble, Ranjana, Sandhya.np14, Sneha