1
0
mirror of https://github.com/adambard/learnxinyminutes-docs.git synced 2025-08-06 14:56:54 +02:00

[smalltalk/en] add mixed type array (#4109)

This commit is contained in:
Dmytro Sytnik
2024-05-13 15:21:49 -04:00
committed by GitHub
parent 154d5272a0
commit 781ebf270b

View File

@@ -441,8 +441,9 @@ Fixed length collection
- WordArray: Array limited to word elements (0-2^32) - WordArray: Array limited to word elements (0-2^32)
```smalltalk ```smalltalk
| b x y sum max | | b x y z sum max |
x := #(4 3 2 1). "constant array" x := #(4 3 2 1). "constant array"
z := #(1 2 3 'hi'). "mixed type array"
x := Array with: 5 with: 4 with: 3 with: 2. "create array with up to 4 elements" x := Array with: 5 with: 4 with: 3 with: 2. "create array with up to 4 elements"
x := Array new: 4. "allocate an array with specified size" x := Array new: 4. "allocate an array with specified size"
x "set array elements" x "set array elements"