Created
April 14, 2021 06:24
-
-
Save freakflames29/7c90d49d1a0bd4870291971a87b67249 to your computer and use it in GitHub Desktop.
Ruby equal or operator
This file contains hidden or 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
x ||= {} | |
x[:key]="lock" | |
x[:key]||=50 | |
puts x | |
# output {:key=>"lock"} | |
#it is used to assign a value to variable if the variable is not assigned and afer assigning the value we can't change it to new value |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment