// if/else: when condition is not a compile-time constant, both branches executelet result = if condition { a } else { b };// if without else (for side effects)if should_update { counter += 1;}// else if chains work normallylet category = if value < 10 { 0} else if value < 100 { 1} else { 2};// for loops: fixed iteration count requiredfor i in 0..10 { process(arr[i]);}// match expressions with literal, range, struct, tuple, array patterns and guardslet bucket = match x { v if v < 5 => 0, v if v < 10 => 1, _ => 2,};// plain if letif let Point { x: 0, y } = p { y} else { -1}// if let combined with && requires edition = "2024" in encrypted-ixs/Cargo.tomlif let Point { x: 0, y } = p && y > 0 { y} else { -1}// matches! macrolet in_range = matches!(x, 0..=9);let is_small = matches!(x, 0 | 1 | 2);
// Constructlet a = BaseField25519::from_u64(42);let b = BaseField25519::power_of_two(8); // 256// Arithmetic (mod 2^255 - 19)let c = a + b;let d = a * b;let e = -a;// Division (no / operator: use methods)let inv = b.safe_inverse(); // 0 if b == 0let quot = a.field_division(b); // 0 if b == 0let euc = a.euclidean_division(b); // panics if b == 0// Extractlet n: u64 = c.to_u64_unchecked(); // incorrect result if value exceeds u64 rangelet bytes = c.to_le_bytes(); // [u8; 32]