This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(module | |
(func (export "foo") (param $foo i32) (result i32) | |
(local $x i32) | |
;;if blocks (if, block, loop, etc) have a (result x) then they return a value! | |
(if (result i32) (local.get $foo) | |
(if (result i32) | |
(i32.gt_s (local.get $foo) (i32.const 10)) | |
(i32.const 10) | |
(block (result i32) (i32.const 1)) | |
) | |
(loop $loop (result i32) | |
(local.tee $x (i32.add (local.get $x) (i32.const 3) )) | |
(br_if $loop (i32.lt_s (local.get $x) (i32.const 100))) | |
) | |
) | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment