new tasks
This commit is contained in:
parent
2a4d27cea0
commit
80737d5a6a
1194 changed files with 15353 additions and 1 deletions
12
Task/Arrays/Smalltalk/arrays-2.st
Normal file
12
Task/Arrays/Smalltalk/arrays-2.st
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
|array|
|
||||
"creates an array that holds up to 20 elements"
|
||||
array := Array new: 20 .
|
||||
"access the first element: array base is 1"
|
||||
(array at: 1) displayNl.
|
||||
"put 100 as second value; you can put any object,
|
||||
in particular SmallInteger"
|
||||
array at: 2 put: 100.
|
||||
"initialize an array from a 'constant' given array"
|
||||
array := Array withAll: #('an' 'apple' 'a' 'day' 'keeps' 'the' 'doctor' 'away').
|
||||
"Replacing apple with orange"
|
||||
array at: 2 put: 'orange'.
|
||||
Loading…
Add table
Add a link
Reference in a new issue