Created
May 24, 2013 20:02
-
-
Save adambray/5646135 to your computer and use it in GitHub Desktop.
Simple Ruby used during intro to Ruby lesson of YEI Bootcamp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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