Other Pages

Slides

nil

Nil

nil is a magic object

There Is No Spoon

nil is the object that means "there is no object"

Experiment

fruit = "apple"
fruit = nil
fruit.reverse

Read the error!

Errors are good

They tell you

Interpret this error:

fruit.reverse
NoMethodError: undefined method `reverse' for nil:NilClass

Fail Fast, Fail Often