more fun with "here documents"
This commit is contained in:
parent
4fdc97001d
commit
01f4b7fb64
@ -10,6 +10,10 @@ Grocery list
|
||||
|
||||
GROCERY_LIST
|
||||
|
||||
puts '
|
||||
Categorized Grocery list
|
||||
------------------------
|
||||
'
|
||||
|
||||
puts 'Produce', '-------', <<PRODUCE, 'Dairy', '-----', <<DAIRY, '* Organic'
|
||||
1. Strawberries*
|
||||
@ -20,4 +24,15 @@ PRODUCE
|
||||
2. Milk*
|
||||
3. Cottage Cheese
|
||||
|
||||
|
||||
DAIRY
|
||||
|
||||
|
||||
puts
|
||||
puts 'Indented Grocery list',
|
||||
'---------------------', <<-GROCERY_LIST
|
||||
1. Salad mix.
|
||||
2. Strawberries.
|
||||
3. Cereal.
|
||||
4. Milk.
|
||||
GROCERY_LIST
|
||||
|
8
wikibooks-tutorial/quiz.rb
Normal file
8
wikibooks-tutorial/quiz.rb
Normal file
@ -0,0 +1,8 @@
|
||||
name = 'Charlie Brown'
|
||||
|
||||
puts <<"QUIZ"
|
||||
Student: #{name}
|
||||
|
||||
1.\tQuestion: What is 4+5?
|
||||
\tAnswer: The sum of 4 and 5 is #{4+5}
|
||||
QUIZ
|
Loading…
Reference in New Issue
Block a user