//! returns: 0 //! Fallback expressions use the enclosing scope before binding their result. /// Return the optional payload or the outer fallback value. fn choose(input: ?u32, value: u32) -> u32 { { let value = input else value; return value; } } /// Evaluate a fallback with its own local binding and conditional result. fn chooseBlock(input: ?u32, value: u32) -> u32 { { let value = input else { let mut offset = value; if value > 10 { set offset += 1; } return offset; }; return value; } } /// Check both paths through a fallback that shares the new binding's name. @default fn main() -> u32 { assert choose(nil, 17) == 17; assert choose(23, 17) == 23; assert chooseBlock(nil, 17) == 18; assert chooseBlock(nil, 3) == 3; assert chooseBlock(23, 17) == 23; return 0; }