Simple Constructs in Ruby
What have I found out so far?
Loops like the while are available. Again, the example below illustrates the same.
Technorati Tags: Simple Constructs in Ruby
Blogs linking to this article
- Definition of Ruby
- Ruby Windows Installer
- Interactive Ruby - Open a new DOS window and type irb --simple-prompt A prompt appears as >>
- Run a Ruby program by typing ruby hello.rb
- Learnt some features of Ruby like comments, naming rules, variables, constants, strings etc.
- Various Text Editors/IDEs like SciTE, NotePad2
# if elseSome common conditional operators are: ==, != >=, <=, >, <
var = 5
if var > 4
puts "variable is greater than 4"
puts "I can have multiple statements here"
if var == 5
puts "nested if else possible"
else
puts "too cool"
end
else
puts "variable is not greater than 5"
puts "I can have multiple statements here"
end
Loops like the while are available. Again, the example below illustrates the same.
# Loops
var = 0
while var < 10
puts var.to_s
var += 1
end
First Post | Previous | Next
Technorati Tags: Simple Constructs in Ruby
Blogs linking to this article
0 Comments:
Post a Comment
<< Home