#!/usr/bin/ruby
foreignHello = {
'english ' => 'hello',
'polynesian ' => 'aloha',
'spanish ' => 'hola',
'italian ' => 'caio',
'dutch ' => 'hallo'
}
if !ARGV[0]
puts "ruby script to demonstrate control structures and arrays"
puts "usage: ./ruby1.rb <number of times to print hello>"
else
max=ARGV[0].to_i
puts "method #1 - using .times"
(max).times { puts "hello" }
foreignHello.each do |language| |word|
puts "Hello in #{language} #{word}"
end
puts "Now enter the word 'hello' or 'hi' to exit this!"
while STDIN.gets
if /hello|hi/
puts "Thank you for playing!"
exit
end
end
end