REBOL 3 Docs | Guide | Concepts | Functions | Datatypes | Errors |
TOC < Back Next > | Updated: 17-Aug-2010 Edit History |
Set a word to a default value if it hasn't been set yet.
Arguments:
word [word! set-word! lit-word!] - The word (use :var for word! values)
value - The value
See also:
The default function is a clear way to indicate that you want a variable set to a default value if it's not already been set.
For example:
default size 100
would set size to 100 if it's not already been set to some other value.
You can think of default as a shortcut for any when used like this:
size: any [size 100]
However, default avoids the need to specify the size word twice and also makes the intention of your code more clear. It's quite often used for global configuration variables that may or may not have been set by prior code.
TOC < Back Next > | REBOL.com - WIP Wiki | Feedback Admin |