跳至内容

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]
]
华夏公益教科书