Type system examples
Literal defaults
Section titled “Literal defaults”let x = 1;->i64let y = 1.0;->f64
Widening
Section titled “Widening”let x: i64 = 1;(impliciti32->i64allowed)let y: f64 = 1.0f32;(implicitf32->f64allowed)
Explicit cast required
Section titled “Explicit cast required”let x: i32 = 1;-> error withoutcast(i32, 1)let y: f64 = 1;-> error withoutcast(f64, 1)
Mixed arithmetic
Section titled “Mixed arithmetic”1 + 2.0-> error unless one side casted.