Skip to content

Instantly share code, notes, and snippets.

@adambray
Created May 24, 2013 20:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adambray/5646135 to your computer and use it in GitHub Desktop.
Save adambray/5646135 to your computer and use it in GitHub Desktop.
Simple Ruby used during intro to Ruby lesson of YEI Bootcamp
def say_hello first_name, last_name
puts "hello, #{first_name}, #{last_name}"
end
say_hello "Adam", "Bray"
name = "Charlie"
name = name.downcase.reverse
if name == "adam"
puts "you are so cool!"
puts "you are so cool!"
puts "you are so cool!"
elsif name == "casey"
puts "I guess you're cool too!"
elsif name == "bob"
puts "Hmmm, Hi Bob!"
else
puts "I'm not so sure"
end
def scratch(pet)
puts "I just scratched #{pet}"
end
my_pets = ["Teeka", "Spaetzle", "Don the Panda" ]
scratch(my_pets[0])
scratch(my_pets[1])
scratch(my_pets[2])
my_pets.each_with_index do |current_pet, index|
scratch(current_pet)
puts "just scratched number #{index + 1}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment