nil
Goals
Step 1
IRB# Where is the letter "a" in apple? "apple".index("a") # Where is the letter "z"? "apple".index("z")
Step 2
IRBputs "What does puts evaluate to?"
Step 3
IRBword = "hello" word.upcase word = nil word.upcaseExpected result:NoMethodError: undefined method 'upcase' for nil:NilClassIRBword.classIRBword.methods.sort
Step 4
IRBword = "something" word.nil? word = nil word.nil?IRBword == nilname = nil if name.nil? puts "The name hasn't been set yet." else puts "Your name is #{name}" end
Explanation
Further Reading
Next Step:
Go on to Symbols
Back to Conditionals