Rebol 程式設計/設計指南/使用外殼
外觀
< Rebol 程式設計 | 設計指南
命令外殼是一種測試想法或快速查詢函式答案的絕佳方式。
在外殼中,你可以快速顯示有關特定函式及其引數的資訊。
此外,SOURCE 函式還能顯示其他函式的編寫方式。
>> help func
USAGE:
FUNC spec body
DESCRIPTION:
Defines a user function with given spec and body.
FUNC is a function value.
ARGUMENTS:
spec -- Help string (opt) followed by arg words (and opt type and string) (Type: block)
body -- The body block of the function (Type: block)
(SPECIAL ATTRIBUTES)
catch
>> source func
func: func [
"Defines a user function with given spec and body."
[catch]
spec [block!] {Help string (opt) followed by arg words (and opt type and string)}
body [block!] "The body block of the function"
][
throw-on-error [make function! spec body]
]