Created
August 7, 2017 03:51
-
-
Save danman01/ba59c826fd54b3084102939497138a66 to your computer and use it in GitHub Desktop.
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
1.upto(10) do |i| | |
puts "i" | |
return 'hey I\'m returning!' | |
end | |
# what is returned? Why? | |
def count(upto) | |
msg = 'hey I\'m returning!' | |
1.upto(upto) do |i| | |
puts 'i' | |
return msg | |
end | |
end | |
# what is returned? Why? | |
# how do you use the method? | |
# how can we rewrite the method to go through the entire iteration, and then return the message | |
# how do we get i to be the current iteration? | |
def count2(upto) | |
1.upto(upto) do |i| | |
puts 'i is ' + i.to_s | |
end | |
'hey I\'m returning' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment