REBOL 3 Docs | Guide | Concepts | Functions | Datatypes | Errors |
TOC < Back Next > | Updated: 6-Feb-2009 Edit History |
The none! datatype contains a single value that represents nothing or no value.
The concept of none is not the same as an empty block, empty string, or null character. It is an actual value that represents non-existence.
A none! value can be returned from various functions, primarily those involving series (for example, pick and find).
The REBOL word none! is defined as a none! datatype and contains a none! value. The word none! is not equivalent to zero or false. However, none! is interpreted as false by many functions.
A none! value has many uses such as a return value from series functions like pick, find and select:
if (pick series 30) = none [...]
In databases, a none! can be a placeholder for missing values:
email-database: [ "Bobby" bob@rebol.com 40 "Linda" none 23 "Sara" sara@rebol.net 33 ]
It also can be used as a logic value:
secure none
The word none! is predefined to hold a none! value.
Although none! is not equivalent to zero or false, it is valid within conditional expressions and has the same effect as false:
probe find "abcd" "e"
none
if find "abcd" "e" [print "found"]
The to-none function always returns none!.
Use none? to determine whether a value is a none! datatype.
print none? 1
false
print none? find [1 2 3] 4
true
The form, print, and mold functions print the value none! when passed a none! argument.
probe form none
none
probe mold none
none
print none
none
TOC < Back Next > | REBOL.com - WIP Wiki | Feedback Admin |