Functions and Methods
Functions in Flint use straightforward syntax:
fn add(a: i32, b: i32) -> i32 {
return a + b
}
Explicit Return
Flint requires return. There is no implicit “last expression” return rule.
That choice keeps function exits more obvious for both readers and tools.
Methods
Methods live in impl blocks:
struct Counter {
value: i32,
}
impl Counter {
fn bump(mut self) {
self.value = self.value + 1
}
}
Method syntax is meant to stay unsurprising. An impl block attaches behavior to a type. A mut self receiver makes mutation explicit.