lipi लिपि

A tiny language that compiles to WebAssembly, right here in your browser

Program

    
                

    The language in one screen

    Values

    int (32-bit), float (64-bit) and bool. Ints and floats never mix silently: convert with float(n) or int(x).

    let n = 42;
    let x: float = 2.5;
    let ok = n > 40 && x < 3.0;

    Control flow

    if/else, while, for i in a..b (b not included), break, continue and return.

    for i in 0..10 {
      if i % 2 == 0 { continue; }
      print(i);
    }

    Functions

    Parameters and results have types; every path must return. Recursion works.

    fn gcd(a: int, b: int) -> int {
      if b == 0 { return a; }
      return gcd(b, a % b);
    }

    Built in