Anonymous user
Multiple distinct objects: Difference between revisions
m
→{{header|M2000 Interpreter}}
No edit summary |
|||
Line 751:
=={{header|M2000 Interpreter}}==
<lang M2000 Interpreter>
Module CheckIt {
Form 60, 40
Foo=Lambda Id=1 (m)->{▼
}▼
=Alfa(m, id)▼
id++▼
}▼
Dim A(10)<<Foo(20)▼
\\ for each arrayitem call Foo(20)▼
TestThis()▼
\\ call once foo(20) and result copy to each array item▼
Dim A(10)=Foo(20)▼
TestThis()▼
->Foo(m)▼
\\ Not only the same id, but the same group▼
\\ each item is pointer to group▼
Dim A(10)=Bar(20)▼
TestThis()▼
Sub TestThis()▼
Local i▼
For i=0 to 9 {▼
For A(i){▼
.x++▼
▲ Print .id , .x
}
▲ =Alfa(m, id)
▲ id++
}
▲ Dim A(10)<<Foo(20)
End Sub▼
▲ \\ for each arrayitem call Foo(20)
▲ TestThis()
▲ \\ call once foo(20) and result copy to each array item
▲ Dim A(10)=Foo(20)
▲ TestThis()
▲ ->Foo(m)
▲ }
▲ \\ Not only the same id, but the same group
▲ \\ each item is pointer to group
▲ Dim A(10)=Bar(20)
▲ TestThis()
▲ Sub TestThis()
▲ Local i
▲ For i=0 to 9 {
▲ For A(i){
.x++
Print .id , .x
}
Print
▲ End Sub
▲}
Checkit
</lang>
=={{header|Mathematica}}==
|