Created
December 19, 2019 18:10
-
-
Save greathmaster/3232b5c2d024f1c7e3a3275b83141c1c to your computer and use it in GitHub Desktop.
Ruby Lazy Evaluation Example
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
#Lazy evaluation in Ruby | |
@menu || = ["cookies", "bananas", "water"] | |
#The above is syntatic sugar for | |
@menu = @menu || ["cookies", "bananas", "water"] | |
#Similar concept to | |
x = x + 10 #Both are the same, but different snytax | |
x += 10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment