跳轉到內容

Rebol 程式設計/函式

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

定義具有區域性詞的使用者函式。

FUNCTION 是一個函式值。

  • spec -- 可選的幫助資訊,後面跟著引數詞(以及可選的型別和字串)(型別:塊)
  • vars -- 函式的區域性詞列表(型別:塊)
  • body -- 函式的函式體塊(型別:塊)

原始碼

[編輯 | 編輯原始碼]
function: func [
    "Defines a user function with local words." 
    spec [block!] {Optional help info followed by arg words (and optional type and string)} 
    vars [block!] "List of words that are local to the function" 
    body [block!] "The body block of the function"
][
    make function! head insert insert tail copy spec /local vars body
]
華夏公益教科書