aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorgingerBill <ginger.bill.22@gmail.com>2016-07-23 11:41:11 +0100
committergingerBill <ginger.bill.22@gmail.com>2016-07-23 11:41:11 +0100
commit3fe7fc344d7d17a571a01e531db4a0e5ff057c9f (patch)
treeca617e7e190fd9cf2989bdd3a12e8bff37004f26 /examples
parentf8fd6fce0b9aabd9562ac8d0dda712154b829f26 (diff)
Compound literals and Warnings
Diffstat (limited to 'examples')
-rw-r--r--examples/test.odin33
1 files changed, 8 insertions, 25 deletions
diff --git a/examples/test.odin b/examples/test.odin
index 2dd012681..8d23dbaa3 100644
--- a/examples/test.odin
+++ b/examples/test.odin
@@ -1,27 +1,10 @@
-// import "other"
-
-TAU :: 6.28;
-PI :: PI/2;
-
-type AddProc: proc(a, b: int) -> int;
-
-
-do_thing :: proc(p: AddProc) {
- p(1, 2);
-}
-
-add :: proc(a, b: int) -> int {
- return a + b;
-}
-
-
main :: proc() {
- x : int = 2;
- x = x * 3;
-
- // do_thing(add(1, x));
- do_thing(proc(a, b: int) -> f32 {
- return a*b - a%b;
- });
-
+ type Vec2: struct { x, y: f32; }
+ v := Vec2{1, 1};
+ a := [2]int{1, 2}; // Array 2 of int
+ s := []int{1, 2}; // Slice of int
+ _, _ = a, s;
+ // Equivalent to
+ // sa := [2]int{1, 2}; s := sa[:];
+ v.x = 1;
}