Skip to content

Instantly share code, notes, and snippets.

@greathmaster
Created December 19, 2019 18:10
Show Gist options
  • Save greathmaster/3232b5c2d024f1c7e3a3275b83141c1c to your computer and use it in GitHub Desktop.
Save greathmaster/3232b5c2d024f1c7e3a3275b83141c1c to your computer and use it in GitHub Desktop.
Ruby Lazy Evaluation Example
#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