2021-06-13 09:50:18 -05:00
|
|
|
owo Pass-by-reference test
|
|
|
|
|
|
|
|
owo Swap two variables.
|
|
|
|
functio swap(left, right) {
|
2022-04-18 13:34:08 -05:00
|
|
|
dim tmp left;
|
|
|
|
right =: left;
|
|
|
|
tmp =: right;
|
2021-06-13 09:50:18 -05:00
|
|
|
}
|
|
|
|
|
2022-04-18 13:34:08 -05:00
|
|
|
dim foo /*hello*/;
|
|
|
|
dim bar /*world*/;
|
2021-06-13 09:50:18 -05:00
|
|
|
|
|
|
|
swap(foo, bar);
|
|
|
|
|
2022-04-18 13:34:08 -05:00
|
|
|
if (foo ain't /*world*/) {
|
2022-02-22 15:49:56 -06:00
|
|
|
/*FAILED*/ print;
|
|
|
|
/*foo should be 'world', is actually:*/ print;
|
2021-08-09 15:41:02 -05:00
|
|
|
foo print;
|
2021-06-13 09:53:33 -05:00
|
|
|
}
|
|
|
|
|
2022-04-18 13:34:08 -05:00
|
|
|
if (foo = /*world*/) {
|
2022-02-22 15:49:56 -06:00
|
|
|
/*OK*/ print;
|
2021-06-13 09:53:33 -05:00
|
|
|
}
|