Ruby and nil object

I am new to the world of rubies, and now I am studying it. I read google about an object nil, but still can't figure out what it is?

Can someone explain me in more detail or share any link for further reading?

+3
source share
2 answers

nilis the only instance of the class NilClass. It does not have any special behavior (other than the fact that it is interpreted as false in a Boolean context (for example, in a state if), as Andrew Grimm successfully pointed out). The goal nilis to indicate “no result”.

, , , , nil, , . i th , i, nil.

, , Object (.. , ) , .

+6

. Ruby , nil singleton NilClass. nil . , , (, ).

0

Source: https://habr.com/ru/post/1787934/


All Articles