1.) Open terminal by pressing Ctrl + Alt + T and write command like this:
– emacs -nw helloworld.rb
– In ruby file extension must be .rb so here we give the name as helloworld rb , helloworld is a file name and .rb is extension
2.) And write code here in helloworld.rb:
puts “Hello World”
3.) Save file by pressing Ctrl + x + s
4.) Exit from editor by pressing Ctrl + x + c
5.) Now how to execute our first program so for that you want to write like this syntax :
– ruby filename.rb
– ex : ruby hellowolrd.rb
– in our case result should be like this
Hello World
– emacs -nw helloworld.rb
– In ruby file extension must be .rb so here we give the name as helloworld rb , helloworld is a file name and .rb is extension
2.) And write code here in helloworld.rb:
puts “Hello World”
3.) Save file by pressing Ctrl + x + s
4.) Exit from editor by pressing Ctrl + x + c
5.) Now how to execute our first program so for that you want to write like this syntax :
– ruby filename
– ex : ruby hellowolrd.rb
– in our case result should be like this
Hello World
0 comments:
Post a Comment