diff options
| author | gingerBill <ginger.bill.22@gmail.com> | 2016-08-14 19:37:47 +0100 |
|---|---|---|
| committer | gingerBill <ginger.bill.22@gmail.com> | 2016-08-14 19:37:47 +0100 |
| commit | 0edae8c8482dd4763737b01deb09a4732a2f35ec (patch) | |
| tree | c15190cd0c55fa1e3db06591af89225d5087bf8e /examples/basic.odin | |
| parent | b44bc99b889bb07dfe4f843ddeefd7483e0fba82 (diff) | |
Vector index works with booleans now.
Diffstat (limited to 'examples/basic.odin')
| -rw-r--r-- | examples/basic.odin | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/examples/basic.odin b/examples/basic.odin index 9141aed87..60a13cce2 100644 --- a/examples/basic.odin +++ b/examples/basic.odin @@ -1,3 +1,9 @@ +// C Runtime procedures +putchar :: proc(c: i32) -> i32 #foreign +malloc :: proc(sz: int) -> rawptr #foreign; +free :: proc(ptr: rawptr) #foreign; + + print_string :: proc(s: string) { for i := 0; i < len(s); i++ { putchar(s[i] as i32); @@ -116,21 +122,10 @@ print_uint_base :: proc(i, base : uint) { } -// f64 - - -print_f64 :: proc(f : f64) { - buf: [128]byte; - - if f == 0 { - value : u64; - +print_bool :: proc(b : bool) { + if b { + print_string("true"); } else { - if f < 0 { - print_rune('-'); - } - print_rune('0'); + print_string("false"); } - } - |