From 31bcfde951389e6f9abd2e04407db84ae9ff3191 Mon Sep 17 00:00:00 2001 From: Steven Degutis Date: Sat, 10 Mar 2012 23:51:37 -0600 Subject: [PATCH] arrays --- arrays.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/arrays.go b/arrays.go index 6742f2f..fea95db 100644 --- a/arrays.go +++ b/arrays.go @@ -1,8 +1,16 @@ package go_koans -var __string__ string +var __string__ string = "impossibly lame value" +var __int__ int = -1 func testArrays() { - fruits := [3]string{"apple", "orange"} - assert(fruits[0] == __string__) + fruits := [4]string{"apple", "orange", "mango"} + + assert(fruits[0] == __string__) // indexes begin at 0 + assert(fruits[1] == __string__) // one is indeed the loneliest number + assert(fruits[2] == __string__) // it takes two to ...tango? + assert(fruits[3] == __string__) // there is no spoon + + assert(len(fruits) == __int__) // the length is what the length is + assert(cap(fruits) == __int__) // it can hold no more }