Ruby/Language Basics/Code statement

Материал из Wiki.crossplatform.ru

(Различия между версиями)
Перейти к: навигация, поиск
м (1 версия: Импорт выборки материалов по Ruby)
 

Текущая версия на 17:59, 13 сентября 2010

Group multiple expressions into a single expression

age = 24
puts "You"re NOT a teenager" unless age > 12 && age < 20



You don"t need any end-of-line marker at all in Ruby.

# If you can"t fit a Ruby statement on one line, 
# you can tell Ruby that you are continuing that line of code on a second line by using backslashes
 
puts \
"Hello from Ruby."