跳到內容

Rebol 程式設計/func

來自華夏公益教科書,開放的書籍,開放的世界
FUNC spec body 

使用給定的規範和主體定義使用者函式。

FUNC 是一個函式值。

  • spec -- 幫助字串 (可選) 後跟引數詞 (和可選型別和字串) (型別:塊)
  • body -- 函式的主體塊 (型別:塊)

(特殊屬性)

[編輯 | 編輯原始碼]
  • 捕獲

原始碼

[編輯 | 編輯原始碼]
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]
]
華夏公益教科書