end
end 用於結束 block、loop、if 或 else。在其他示例中,我們使用了不需要 end 的 s 表示式語法,因此您在這裡的其他示例中不會找到它。然而,瞭解它仍然很有用,因為這是瀏覽器在開發者工具中顯示的內容。
試一試
(module
;; import the browser console object, you'll need to pass this in from JavaScript
(import "console" "log" (func $log (param i32)))
(func
i32.const 0 ;; change to positive number if you want to run the if block
if
i32.const 1
call $log ;; should log '1'
end
)
(start 1) ;; run the first function automatically
)
const url = "{%wasm-url%}";
await WebAssembly.instantiateStreaming(fetch(url), { console });
語法
wat
i32.const 0
if
;; do something
end
| 指令 | 二進位制操作碼 |
|---|---|
end |
0x0b |