updating arrays

This commit is contained in:
Steven Degutis
2012-03-11 09:58:56 -05:00
parent ca53462aae
commit e666a45d8e

View File

@@ -9,19 +9,22 @@ func testArrays() {
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(fruits[3] == __string__) // there is no spoon, only an empty value
assert(len(fruits) == __int__) // the length is what the length is
assert(cap(fruits) == __int__) // it can hold no more
tasty_fruits := fruits[1:3] // defining ones self as a variation of another
assert(tasty_fruits[0] == __string__) // slices of arrays share some identity
tasty_fruits := fruits[1:3] // defining oneself as a variation of another
assert(tasty_fruits[0] == __string__) // slices of arrays share some data
assert(tasty_fruits[1] == __string__) // albeit slightly askewed
tasty_fruits[0] = "lemon" // but are their shared roots truly identical?
assert(len(tasty_fruits) == __int__) // its length is manifest
assert(cap(tasty_fruits) == __int__) // but its capacity is surprising!
assert(fruits[0] == __string__) // has this remained the same?
assert(fruits[1] == __string__) // how about this?
tasty_fruits[0] = "lemon" // are their shared roots truly identical?
assert(fruits[0] == __string__) // has this element remained the same?
assert(fruits[1] == __string__) // how about the second?
assert(fruits[2] == __string__) // surely one of these must have changed
assert(fruits[3] == __string__) // but who can know these things
}