test_switch_continue.zig (509B) - Raw
1 const std = @import("std"); 2 3 test "switch continue" { 4 sw: switch (@as(i32, 5)) { 5 5 => continue :sw 4, 6 7 // `continue` can occur multiple times within a single switch prong. 8 2...4 => |v| { 9 if (v > 3) { 10 continue :sw 2; 11 } else if (v == 3) { 12 13 // `break` can target labeled loops. 14 break :sw; 15 } 16 17 continue :sw 1; 18 }, 19 20 1 => return, 21 22 else => unreachable, 23 } 24 } 25 26 // test