Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
10
Task/Null-object/Ruby/null-object.rb
Normal file
10
Task/Null-object/Ruby/null-object.rb
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
puts "@object is nil" if @object.nil? # instance variable
|
||||
|
||||
puts "$object is nil" if $object.nil? # global variable, too
|
||||
|
||||
# It recognizes as the local variable even if it isn't executed.
|
||||
object = 1 if false
|
||||
puts "object is nil" if object.nil?
|
||||
|
||||
# nil itself is an object:
|
||||
puts nil.class # => NilClass
|
||||
Loading…
Add table
Add a link
Reference in a new issue