more fun with "here documents"

This commit is contained in:
Dan Buch 2011-01-03 14:01:42 -05:00
parent 4fdc97001d
commit 01f4b7fb64
2 changed files with 23 additions and 0 deletions

View File

@ -10,6 +10,10 @@ Grocery list
GROCERY_LIST GROCERY_LIST
puts '
Categorized Grocery list
------------------------
'
puts 'Produce', '-------', <<PRODUCE, 'Dairy', '-----', <<DAIRY, '* Organic' puts 'Produce', '-------', <<PRODUCE, 'Dairy', '-----', <<DAIRY, '* Organic'
1. Strawberries* 1. Strawberries*
@ -20,4 +24,15 @@ PRODUCE
2. Milk* 2. Milk*
3. Cottage Cheese 3. Cottage Cheese
DAIRY DAIRY
puts
puts 'Indented Grocery list',
'---------------------', <<-GROCERY_LIST
1. Salad mix.
2. Strawberries.
3. Cereal.
4. Milk.
GROCERY_LIST

View 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