aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2018-12-08 14:12:52 +0000
committergingerBill <bill@gingerbill.org>2018-12-08 14:12:52 +0000
commitd05837ab6dc291ee8ee3d94b33f86a6472c5847f (patch)
tree67192ab848409750fa6371eabf7680a4800ce8d3 /examples
parent4369a1714e9e039abc09bdb095b8044ad2f5d2ff (diff)
Labels for block and if statements (break only)
Diffstat (limited to 'examples')
-rw-r--r--examples/demo/demo.odin40
1 files changed, 33 insertions, 7 deletions
diff --git a/examples/demo/demo.odin b/examples/demo/demo.odin
index 5f4f0dfb2..2d4303682 100644
--- a/examples/demo/demo.odin
+++ b/examples/demo/demo.odin
@@ -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();