aboutsummaryrefslogtreecommitdiff
path: root/code
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2016-11-20 01:34:43 +0000
committerGinger Bill <bill@gingerbill.org>2016-11-20 01:34:43 +0000
commit24347ced45aabd3ce4f4a261b8140a976cadff2e (patch)
tree32ba1cd9ec5ce7503dd0a86ad8e417cc73324cc1 /code
parent24ca1065214f51cfbeb9c0eff98002c7d33139a2 (diff)
Support `any` in `match type`
Diffstat (limited to 'code')
-rw-r--r--code/demo.odin13
1 files changed, 13 insertions, 0 deletions
diff --git a/code/demo.odin b/code/demo.odin
index a72fbea6a..b44d245e8 100644
--- a/code/demo.odin
+++ b/code/demo.odin
@@ -1,6 +1,19 @@
#import "fmt.odin"
#import "game.odin"
+variadic :: proc(args: ..any) {
+ for i := 0; i < args.count; i++ {
+ match type a : args[i] {
+ case int: fmt.println("int", a)
+ case f32: fmt.println("f32", a)
+ case f64: fmt.println("f64", a)
+ case string: fmt.println("string", a)
+ }
+ }
+}
+
main :: proc() {
fmt.println("Hellope, everybody!")
+
+ variadic(1, 1.0 as f32, 1.0 as f64, "Hellope")
}