Null object: Difference between revisions

Added EchoLisp
(Add Lily example)
(Added EchoLisp)
Line 357:
 
<lang e>object == null</lang>
 
=={{header|EchoLisp}}==
The null object - '''null''' - is the same as the empty list (). It may be tested with the '''null?''' or '''!null?''' predicates. NB : null is not the same as the boolean #f (false). null evaluates to #t (true) in logical operations.
 
<lang lisp>
null → null
() → null
(null? 3) → #f
(!null? 4) → #t
(null? null) → #t
 
;; careful - null is not false :
(if null 'OUI 'NON) → OUI
 
;; usual usage : recursion on lists until (null? list)
(define (f list)
(when (!null? list)
(write (first list)) (f (rest list))))
 
(f '( a b c)) → a b c
</lang>
 
=={{header|Eiffel}}==