diff options
| author | Ginger Bill <bill@gingerbill.org> | 2017-02-14 19:26:32 +0000 |
|---|---|---|
| committer | Ginger Bill <bill@gingerbill.org> | 2017-02-14 19:26:32 +0000 |
| commit | 71100ed427ee2eec8d8a9d4d9616102738097e80 (patch) | |
| tree | 913d12b69a404635d0b2442262a300c7084b55bf /code | |
| parent | 3ecf3505fd62c6aa10190a0be97e8572476e8c8b (diff) | |
Ternary expression (removed if and block expression)
Diffstat (limited to 'code')
| -rw-r--r-- | code/demo.odin | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/code/demo.odin b/code/demo.odin index 438488045..a3fee1555 100644 --- a/code/demo.odin +++ b/code/demo.odin @@ -9,18 +9,14 @@ main :: proc() { - x := type_info(int); - t1, ok := union_cast(^Type_Info.Integer)x; - _, ok = union_cast(^Type_Info.Integer)x; - t2 := union_cast(^Type_Info.Integer)x; - - + x: f32 = false ? 123 : 55; + fmt.println("Ternary:", x); /* /* Version 0.1.1 Added: - * Dynamic Arrays `[...]Type` + * Dynamic Arrays [dynamic]Type` * Dynamic Maps `map[Key]Value` * Dynamic array and map literals * Custom struct alignemnt `struct #align 8 { bar: i8 }` @@ -32,6 +28,7 @@ main :: proc() { * enum types have an implict `names` field, a []string of all the names in that enum * immutable variables are "completely immutable" - rules need a full explanation * `slice_to_bytes` - convert any slice to a slice of bytes + * `union_cast` allows for optional ok check Removed: * Maybe/option types @@ -101,7 +98,7 @@ main :: proc() { } { - x: [...]f64; + x: [dynamic]f64; reserve(x, 16); defer free(x); append(x, 2_000_000.500_000, 3, 5, 7); @@ -114,7 +111,7 @@ main :: proc() { } { - x := [...]f64{2_000_000.500_000, 3, 5, 7}; + x := [dynamic]f64{2_000_000.500_000, 3, 5, 7}; defer free(x); fmt.println(x); } |