Sample ruby program
Filed in OpenSource on Jan.28, 2009
1 2 3 | puts "What is your name????" myname = gets.chomp puts "Your name is #{myname }!" |
Let us save this code in a text file first. Preferred extension is .rb but no issues even if no extension provided.
Now on command prompt use this command to execute.
ruby test.rb
This should ask you your name and display your name again if ruby-on-rails installed. It will be something like this:
D:\testruby>ruby test.rg What is your name???? praveen Your name is praveen! D:\testruby>
Related posts:























Leave a Reply
You must be logged in to post a comment.