RosettaCodeData/Task/Create-a-two-dimensional-array-at-runtime/Smalltalk/create-a-two-dimensional-array-at-runtime-4.st
Ingy döt Net 764da6cbbb CDE
2013-04-10 16:57:12 -07:00

20 lines
473 B
Smalltalk

|num1 num2 pseudoArr|
num1 := stdin nextLine asInteger.
num2 := stdin nextLine asInteger.
"we can 'suggest' an initial value for the number
of ''slot'' the table can hold; anyway, if we use
more than these, the table automatically grows"
pseudoArr := LookupTable new: (num1 * num2).
1 to: num1 do: [ :i |
1 to: num2 do: [ :j |
pseudoArr at: {i. j} put: (i * j).
]
].
1 to: num1 do: [ :i |
1 to: num2 do: [ :j |
(pseudoArr at: {i. j}) displayNl.
]
].