Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

||= ruby

a ||= nil
a ||= 0
a ||= 2
# a returns 0
# ||= conditional assignment if a is unassigned then it gets assigned
# otherwise it remains with the value it has as per 2 and 3 lines
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #ruby
ADD COMMENT
Topic
Name
7+1 =