ablescript/examples/pass-by-reference.able

24 lines
348 B
Plaintext
Raw Normal View History

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