← All examples

Consts

consts.zg
bare.never [fn, struct];

pub const 'max' := 8;
const 'pi': bin64 = 3.141_592_653_589_793;
const 'twice_max' := 'max' times 2;
const 'greeting' := "hello " ++ "world";
pub struct P { x: int32 }
pub fn area ['r': bin64] -> bin64 { return 'pi' times 'r' times 'r'; }
MAIN {
    std::print.useful['max', " ", 'twice_max', " ", 'greeting', " ", area[2.0], newln];
    let 's' := 'greeting';
    let 'p' := P[x = 'max'];
    for 'i' from 1 to 'max' by 4 { std::print.useful['i', " "]; }
    std::print.stored[newln];
}
Output
8 16 hello world 12.566370614359172
1 5