Wasm Reference
  • Welcome
  • Nodejs WAT Compiler
  • Types
    • Functions
    • Globals
    • Linear Memory
    • Tables
    • Numbers
    • Text
  • Structures
    • IF
    • LOOP
  • Algorithms
    • Hello World
    • Estimate Pi
  • Maths Helper Algorithms
    • Pseudorandom Number Generator
    • Factorial
    • Dist
    • Map
    • Fract
    • RemF or ModF
    • Round
    • Clamp
    • Mix
    • Pow
    • Approx Sin
    • Approx Cos
    • Approx Tan
    • ToRad and ToDeg
Powered by GitBook
On this page

Was this helpful?

  1. Structures

LOOP

(func (export "count10") (result i32)
    (local $t i32) 
    (set_local $t (i32.const 0)) 
    (block (loop 
      i32.const 10
      get_local $t
      i32.eq 
      br_if 1 
      
      get_local $t
      i32.const 1
      i32.add 
      set_local $t
      br 0 
    ))
    
      get_local $t
  )
PreviousIFNextHello World

Last updated 5 years ago

Was this helpful?