Skip to content

Instantly share code, notes, and snippets.

@Joeventures
Created October 15, 2015 15:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Joeventures/a5dbca81e4268bd814f4 to your computer and use it in GitHub Desktop.
Save Joeventures/a5dbca81e4268bd814f4 to your computer and use it in GitHub Desktop.
1.1. What is the result of the ages.map call? What about ages.each?
The result of ages.map [28, 32, 42, 64] is [56, 64, 84, 128]
The result of ages.each is:
Age is: 28
Age is: 32
Age is: 42
Age is: 64
1.2. Is x in scope during ages.each? x is not in scope.
2.1. What is the value of stuff in a call to print_feels?
I'm not sure I understand the question. However, stuff is a local variable passed to print_feels. In the code, stuff is passed to print_feels from the my_example function. If I were to call my_example(:wednesday), the value of stuff would be "resilient."
3.1. Where are instance variables visible/in scope? Instance variables are in scope within the instance of an object.
3.2. What is the purpose of unit tests? To give the programmer more confidence if code needs to be rewritten/refactored later. And to offer a basic level of assurance that the code written works as intended.
3.3 Can we call methods on a class anywhere we have an instance of that class? Only if the methods are not private.
@Joeventures
Copy link
Author

Doh! My eyes completely glossed over ".sample"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment