Ruby/Language Basics/Code statement

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

Версия от 17:59, 13 сентября 2010; ViGOur (Обсуждение | вклад)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

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."