odin-lang / odin-lang.org

http://odin-lang.org
22 stars 81 forks source link

Small_Array(N, T) container dynamic array in Overview commented output is incorrect #151

Closed mahSource closed 8 months ago

mahSource commented 11 months ago

The examples have output for the fmt.println(sa.len(x), sa.cap(x)) that show elements with commas, they are/should be space delimited in the output See: https://odin-lang.org/docs/overview/#small_arrayn-t-container-dynamic-array . This is the current Overview Example

import sa "core:container/small_array"

x: sa.Small_Array(8, int)
fmt.println(sa.len(x), sa.cap(x)) // 0, 8
sa.append(&x, 1, 2, 3) 
fmt.println(sa.len(x), sa.cap(x)) // 3, 8
fmt.println(sa.slice(&x)) // [1, 2, 3]

Suggest the Overview be updated to this

import sa "core:container/small_array"

x: sa.Small_Array(8, int)
fmt.println(sa.len(x), sa.cap(x)) // 0 8
sa.append(&x, 1, 2, 3) 
fmt.println(sa.len(x), sa.cap(x)) // 3 8
fmt.println(sa.slice(&x)) // [1, 2, 3]

. Notice the commas for the output of 2 lines are removed....a minor update, but should be changed to this.

Skytrias commented 8 months ago

changed it for you 👍