For Gauche 0.9.5


Next: , Previous: , Up: Core library   [Contents][Index]

6.5 Undefined values

While working with Gauche, sometimes you encounter a value printed as #<undef>, an undefined value.

gosh> (if #f #t)
#<undef>

It is a value used as a filler where the actual value doesn’t matter, or to indicate there’s no other suitable value.

Do not confuse undefined values with unbound variables; A variable can be bound to #<undef>, for it is just an ordinary first-class value. On the other hand, an unbound variable means there’s no value associated with the variable.

However, #<undef> may be used in certain occasions to indicate that a value is not provided for the variable. For example, an optional procedure parameter without default value is bound to #<undef> if an actual argument is not given (see Making Procedures). Note that it cannot be distinguished from the case a value is actually provided, and the value just happens to be #<undef>. If you get an #<undef>, you can say at most is that the value doesn’t matter. You shouldn’t let it carry too much meanings.

Being said that, there are a couple of procedures to deal with undefined values.

Function: undefined? obj

Returns #t iff obj is an undefined value.

Function: undefined

Returns an undefined value.


Next: , Previous: , Up: Core library   [Contents][Index]