Skip to content

Instantly share code, notes, and snippets.

@dominictarr
Created April 30, 2020 03:58
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
(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