| 1 | /* correct declarations */ |
| 2 | let |
| 3 | |
| 4 | type arrtype1 = array of int |
| 5 | type rectype1 = {name:string, address:string, id: int , age: int} |
| 6 | type arrtype2 = array of rectype1 |
| 7 | type rectype2 = {name : string, dates: arrtype1} |
| 8 | |
| 9 | type arrtype3 = array of string |
| 10 | |
| 11 | var arr1 := arrtype1 [10] of 0 |
| 12 | var arr2 := arrtype2 [5] of rectype1 {name="aname", address="somewhere", id=0, age=0} |
| 13 | var arr3:arrtype3 := arrtype3 [100] of "" |
| 14 | |
| 15 | var rec1 := rectype1 {name="Kapoios", address="Kapou", id=02432, age=44} |
| 16 | var rec2 := rectype2 {name="Allos", dates= arrtype1 [3] of 1900} |
| 17 | |
| 18 | in |
| 19 | |
| 20 | arr1[0] := 1; |
| 21 | arr1[9] := 3; |
| 22 | arr2[3].name := "kati"; |
| 23 | arr2[1].age := 23; |
| 24 | arr3[34] := "sfd"; |
| 25 | |
| 26 | rec1.name := "sdf"; |
| 27 | rec2.dates[0] := 2323; |
| 28 | rec2.dates[2] := 2323 |
| 29 | |
| 30 | end |