Skip to content

Instantly share code, notes, and snippets.

@agentfin
Created December 14, 2011 14:15
Show Gist options
  • Save agentfin/1476732 to your computer and use it in GitHub Desktop.
Save agentfin/1476732 to your computer and use it in GitHub Desktop.
Branching and while
# branching again
puts 'Hello, world.'
puts 'My name is Inigo Montoya. What\'s your name?'
name = gets.chomp
if name == name.capitalize
# be all kinds of sweet
puts 'I\'ve always loved the name ' + name + ','
puts '...but I\'m going to call you Pretty-Pretty.'
puts 'You\'re very pretty, Pretty-Pretty'.'
else
# be all kinds of nasty
puts 'SAY IT A LITTLE LOUDER ' + name.upcase + '!'
reply = gets.chomp
while reply.downcase != 'die'
# begin harrasing
puts reply
reply = gets.chomp
end
puts 'Later doll.'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment