LEARN VOID / 03

Types & numbers

Make the shape of data clear.

Complete program for the synchronous entry adapter. The result below is the returned integer.

types.voidDownload source
func entry(minutes: i32) -> i32:
    var seconds: i64 = (minutes as i64) * 60
    return seconds as i32
Input 5Expected result 300

Choose the numeric representation

The input is minutes as i32; intermediate seconds use i64. Five minutes become 300 seconds. Signed integers are i8, i16, i32 and i64; unsigned integers use u8 through u64. Floating-point types are f32 and f64.

Convert explicitly

minutes as i64 converts an already typed value. The literal 60 takes its contextual i64 type. Returning through this CLI adapter requires seconds as i32. Conversions are checked: a value outside the target range raises a runtime failure. Integer arithmetic itself wraps.

Keep conditions and text explicit

bool holds true or false. Conditions require Boolean values; logical expressions use and, or and not. UTF-8 text uses string. These types do not introduce implicit numeric or text conversions.