Getting started
A short tour
Read and run a few programs in Hopper.
A function names its input and return types. A file belongs to a module, and its main function is where this example starts.
fn AddTwo(value: i32) -> i32 {
return value + 2;
}
fn main() -> i32 {
return AddTwo(40);
}terminal
hopper run demo src
- Variables explain
letandlet mut. - Loops use a single keyword,
for. - Arrays and structs work with ordinary values.
- References let functions use someone else’s value without moving it.