Ruby syntax does not require indentation. The keyword end is used for demarcation of code blocks starting with begin, case, class, def, do, if, for, and others. Notice the absence of colons.
if x == 5 puts "Five Golden Rings" end You can use semicolons to separate statements on a single line, and lines can continue onto the next line.
a=[2,4, 3]; for i in a; puts "%d " % i; end If the breaking point is too ambiguous for Ruby, you can make it explicit by using the \ continuation character. Ruby supports shell-type comments using #, and also special =begin and =end tags for making documentary or temporary multi-line comments. There is no built-in equivalent to Python's doc strings. |