Support any in match type

This commit is contained in:
Ginger Bill
2016-11-20 01:34:43 +00:00
parent 24ca106521
commit 24347ced45
8 changed files with 191 additions and 134 deletions

View File

@@ -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")
}