Rebol Programming/source

From Wikibooks, open books for an open world
< Rebol Programming
Jump to navigation Jump to search

USAGE:[edit | edit source]

SOURCE 'word 

DESCRIPTION:[edit | edit source]

Prints the source code for a word.

SOURCE is a function value.

ARGUMENTS[edit | edit source]

  • word -- (Type: word)

SOURCE CODE[edit | edit source]

source: func [
    "Prints the source code for a word." 
    'word [word!]
][
    prin join word ": " 
    if not value? word [print "undefined" exit] 
    either any [native? get word op? get word action? get word] [
        print ["native" mold third get word]
    ] [print mold get word]
]