Possible Duplicate:
What does ||= (or equals) mean in Ruby?
What does ||= mean?
I have just started learning RubyMotion and in a lot of examples I see the ||=
syntax. What does this mean?
Here is an example:
def window
@window ||= begin
w = UIWindow.alloc.initWithFrame UIScreen.mainScreen.bounds
w.rootViewController = @navigationController
w
end
It is difficult to search symbols, google ignored the symbols in my query.
Definition of duplicate (Entry 1 of 3) 1 : consisting of or existing in two corresponding or identical parts or examples duplicate invoices. 2 : being the same as another duplicate copies. duplicate. verb.
Some common synonyms of duplicate are copy, facsimile, replica, and reproduction. While all these words mean "a thing made to closely resemble another," duplicate implies a double or counterpart exactly corresponding to another thing.
Signing in counterpart means that duplicate contracts or deeds are printed so that there is a separate copy for signing by each party. The opposite situation is where one copy of the contract or deed is printed and signed by all parties to it.
The definition of duplicate is having double. Two identical baseball cards in a stack are an example of a duplicate. To duplicate is defined as to make a copy. Making multiple copies of one form on a machine is an example of duplicate.
It is an assignment operator which means: or assign this value to a variable.
So if you did something like x ||= y
this meansx || x = y
so if x is nil or false set x to be the value of y.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With