< Rebol Programming

USAGE:

DEFAULT 'word value 

DESCRIPTION:

Set a word to a default value if it hasn't been set yet.

DEFAULT is a function value.

ARGUMENTS

  • word -- The word (use :var for word! values) (Type: word set-word lit-word)
  • value -- The value (Type: any)

SOURCE CODE

default: func [
    {Set a word to a default value if it hasn't been set yet.} 
    'word [word! set-word! lit-word!] "The word (use :var for word! values)" 
    value "The value"
][
    unless all [value? word not none? get word] [set word :value] :value
]
This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.