mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-06 06:48:48 +00:00
Spec changed; Changes introduced; fixed minor bugs
This commit is contained in:
parent
7c7ef67e1d
commit
59f78fe38a
6 changed files with 49 additions and 23 deletions
|
|
@ -1,18 +1,18 @@
|
|||
local samples = [
|
||||
var samples = [
|
||||
{"a", "b", "c"},
|
||||
"string",
|
||||
[],
|
||||
Fruit ("apple"),
|
||||
fun (){skip}
|
||||
fun () {skip}
|
||||
];
|
||||
|
||||
fun show () {
|
||||
-- Note: it would be much better to use iterArray from standard unit Array;
|
||||
-- in that case, however, we wouldn't be able to showcase
|
||||
-- for-loops and []-expressions.
|
||||
for local i; i := 0, i < samples.length, i := i+1 do
|
||||
for var i; i := 0, i < samples.length, i := i+1 do
|
||||
printf (" %s has %d subvalue(s):\n", samples[i].string, samples[i].length);
|
||||
for local j; j := 0, j < samples[i].length, j := j+1 do
|
||||
for var j; j := 0, j < samples[i].length, j := j+1 do
|
||||
printf (" subvalue [%d] = %s\n", j, samples[i][j].string)
|
||||
od
|
||||
od
|
||||
|
|
@ -29,5 +29,5 @@ printf ("And the subvalues of a composite value can be reassigned.\n");
|
|||
samples [2] := [1, 2, 3];
|
||||
samples [0][1] := {};
|
||||
|
||||
show ()
|
||||
show ()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue