#!/usr/local/bin/ruby # Run this program before looking at the code # It teaches about different ways to write loops, but the code is written using eval, # which runs Ruby code from a string. Multi-line strings use << construction. puts "There are many ways to write a loop in Ruby. This program will show some." def showLoop(l) gets puts "Code:" puts l,"\n" print "Result: " eval l puts "" end showLoop "5.times {|i| print i}\n" showLoop <