Nil: a Formal Introduction


#1

I seems from the instructions that if I correctly try to access a key that does not exist I should receive "Nil" as a response. However, I am getting no response at all. So I went back and made a couple of entries to access non-existing keys and one that does exist. I get no "Nil" responses but the key that is present provides the value. j

My question is, why am I not getting "Nil" as a response as the instructions indicate should occur?


#2

nil is not a printable response. However, we can test if a value exists...

puts creatures['tigers'].nil?    # true

#3

Thank you. so the blank response is correct?

From the instructions in this lesson and the next, as well as other posts here, i was under the impression that the word "nil" should appear on screen. So I was just confused that and wondering why everyone else was getting "nil" as a response and I passed the lesson without it.


#4

Also,

puts creatures['dogs'] == nil    # true

It could be that in the old track that was the response, but in the new interface it is not.


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.