From f29e303ce7b11fbe88a4b63374c08130c6c189dd Mon Sep 17 00:00:00 2001 From: Ginger Bill Date: Sun, 26 Feb 2017 15:14:08 +0000 Subject: Slices now have a capacity. --- code/demo.odin | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'code') diff --git a/code/demo.odin b/code/demo.odin index ea5e59a0d..8162fc0d3 100644 --- a/code/demo.odin +++ b/code/demo.odin @@ -8,15 +8,17 @@ #import "strconv.odin"; main :: proc() { - buf: [64]byte; - // len := strconv.generic_ftoa(buf[..], 123.5431, 'f', 4, 64); - x := 624.123; - s := strconv.format_float(buf[..], x, 'f', 6, 64); + // buf: [64]byte; + // // len := strconv.generic_ftoa(buf[..], 123.5431, 'f', 4, 64); + // x := 624.123; + // s := strconv.format_float(buf[..], x, 'f', 6, 64); + // fmt.println(s); + // fmt.printf("%3d\n", 102); + + a: [10]int; + s := a[..0]; + append(s, 1, 2, 6, 3, 6, 5, 5, 5, 5, 1, 2); fmt.println(s); - fmt.printf("%3d\n", 102); - - a := [..]int{0, 1, 2, 3, 4, 5, 6}; - fmt.println(a[0..4]); when false { -- cgit v1.2.3