Hopper
Basics

Numbers

Hopper provides signed and unsigned integers and several floating-point formats.

Integer types use i or u followed by the bit width, such as i32 and u8. Without a type from context, integer literals default to i32 and decimal literals to f64.

A value can widen implicitly if every value in its type fits the destination type. Use as to make a supported conversion explicit.

src/main.hop
fn main() -> i32 {
    let small = 40i8;
    return (small as i32) + 2;
}
terminal

hopper run demo src

The left operand determines the width of integer addition. Native support for unusual widths depends on the LLVM target.