fn free_floating(i32 arg1, i32 arg2) ReturnType { let local_var = arg1 + arg2; } // associated function for the World struct World mut fn set_next(i32 i, i32 j) { // members on this World struct can be accessed with `.` let mut numdots = .numdots; // mutable variables are defined with `let mut` let neighbors = count_neighbors(.current, i, j); // `if` statements are expressions let next = if .current.get(i, j) == 0 { if neighbors != 3 { 0 } else { numdots++; 1 } } else { // Python-like `or` operator if neighbors == 2 or neighbors == 3 { 1 } else { numdots--; 0 } }; if next != 0 { if i < .xmin { .xmin = i; } if i > .xmax { .xmax = i; } if j < .ymin { .ymin = j; } if j > .ymax { .ymax = j; } } }