mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-29 02:40:05 +00:00
Labels for block and if statements (break only)
This commit is contained in:
+33
-7
@@ -126,6 +126,38 @@ general_stuff :: proc() {
|
||||
fmt.println("Y is not defined");
|
||||
}
|
||||
}
|
||||
|
||||
{ // Labelled control blocks
|
||||
block: {
|
||||
if true {
|
||||
fmt.println("break block;");
|
||||
break block;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
branch: if true {
|
||||
fmt.println("break branch;");
|
||||
break branch;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
loop: for true {
|
||||
fmt.println("break loop;");
|
||||
break loop;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
cases: switch {
|
||||
case:
|
||||
fmt.println("break cases;");
|
||||
break cases;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -836,14 +868,8 @@ diverging_procedures :: proc() {
|
||||
foo();
|
||||
}
|
||||
|
||||
foreign export {
|
||||
bar :: proc "c" () -> i32 {
|
||||
return 123;
|
||||
}
|
||||
}
|
||||
|
||||
main :: proc() {
|
||||
when false {
|
||||
when true {
|
||||
general_stuff();
|
||||
union_type();
|
||||
parametric_polymorphism();
|
||||
|
||||
Reference in New Issue
Block a user