Skip to content

Instantly share code, notes, and snippets.

@maker-leo
Created March 19, 2013 17:35
Show Gist options
  • Save maker-leo/5198253 to your computer and use it in GitHub Desktop.
Save maker-leo/5198253 to your computer and use it in GitHub Desktop.
Here's some exercises to go over tonight
#create your own methods
#create a method with one argument, and print it out
#create a method with two arguments
#create a method with one argument, which by default is nil
#create a method that returns two values, depending on if an argument is true or false
#take this hash, and use it to make this string. Make sure you use the hash twice,
#and use string interpolation i.e. "A string #{variable}"
hash = {:dario => "Dario", :leo => "Leo"}
"Hello Dario, Hello Leo"
#Capitalize this array using map
["leo", "aouled", "dario", "ruben"]
#Select from this array only numbers bigger than 10
[15,25,10, 9, 4, 345, 45]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment