puts "text" #outputs text followed by a newline to the console
puts "#{exp}" #evaluates exp
puts '#{exp}' #careful! single quotes do not do interpolation or evaluation of escape sequences such as \t, \n, etc

It is very idiomatic to avoid for or while loops in Ruby, although while loops of course still have a place.
Generally, iterations takes place over something that is Enumerable.
For example, as we see above, all collections should implement “each”, which is the most common looping mechanism.

For instances where the number of times is important but the index is not:

3.times { puts “Hello!” }
**note that { } is equivalent to do end. do end is preferable for multi-line blocks.

Useful utilitiesRandom.rand(max) #returns a random int between 0 and max, excluding max.
any object can have its methods inspects by called obj.methods.
Any class can be edited on the fly to include new methods. This is called opening a class: