aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2018-01-13 22:42:05 +0000
committergingerBill <bill@gingerbill.org>2018-01-13 22:42:05 +0000
commit184efd4f4995dc4d2c784d44495d5b73a6b51a2f (patch)
tree470276f2614132a26cdd3315a9eda50f3b22bac4 /examples
parent6b3c4cc3798177a31fb07e80a6de94cd56c09338 (diff)
Update demo for `using in`
Diffstat (limited to 'examples')
-rw-r--r--examples/demo.odin25
1 files changed, 24 insertions, 1 deletions
diff --git a/examples/demo.odin b/examples/demo.odin
index 0dec48feb..fce879c1f 100644
--- a/examples/demo.odin
+++ b/examples/demo.odin
@@ -4,6 +4,7 @@ import "core:mem.odin"
import "core:bits.odin"
import "core:hash.odin"
import "core:math.odin"
+import "core:math/rand.odin"
import "core:os.odin"
import "core:raw.odin"
import "core:sort.odin"
@@ -596,7 +597,7 @@ array_programming :: proc() {
cross :: proc(a, b: Vector3) -> Vector3 {
i := swizzle(a, 1, 2, 0) * swizzle(b, 2, 0, 1);
j := swizzle(a, 2, 0, 1) * swizzle(b, 1, 2, 0);
- return Vector3(i - j);
+ return i - j;
}
blah :: proc(a: Vector3) -> f32 {
@@ -609,6 +610,27 @@ array_programming :: proc() {
}
}
+
+using println in import "core:fmt.odin"
+
+using_in :: proc() {
+ using print in fmt;
+
+ println("Hellope1");
+ print("Hellope2\n");
+
+ Foo :: struct {
+ x, y: int,
+ b: bool,
+ }
+ f: Foo;
+ f.x, f.y = 123, 321;
+ println(f);
+ using x, y in f;
+ f.x, f.y = 456, 654;
+ println(f);
+}
+
main :: proc() {
when false {
general_stuff();
@@ -617,6 +639,7 @@ main :: proc() {
parametric_polymorphism();
threading_example();
array_programming();
+ using_in();
}
}