nil
Goals
Step 1
Type this in irb:# Where is the letter "a" in apple? "apple".index("a") # Where is the letter "z"? "apple".index("z")
Step 2
Type this in irb:puts "What does puts evalute to?"
Step 3
Type this in irb:word = "hello" word.upcase word = nil word.upcaseExpected result:NoMethodError: undefined method 'downcase' for nil:NilClassType this in irb:word.classType this in irb:word.methods.sort
Step 4
Type this in irb:word = "something" word.nil? word = nil word.nil? # Remember, two equals signs asks if something is equal word == nilname = nil if name.nil? puts "The name hasn't been set yet." else puts "Your name is #{name}" end
Explicación
Further Reading
Next Step:
Go on to Symbols