REBOL Programming/source

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

USAGE:[edit]

SOURCE 'word 

DESCRIPTION:[edit]

Prints the source code for a word.

SOURCE is a function value.

ARGUMENTS[edit]

  • word -- (Type: word)

SOURCE CODE[edit]

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]
]