ablescript/examples/pass-by-reference.able

24 lines
356 B
Plaintext
Raw Permalink Normal View History

owo Pass-by-reference test
owo Swap two variables.
functio swap(left, right) {
2022-06-02 22:10:19 +00:00
tmp dim left;
right =: left;
tmp =: right;
}
2022-06-02 22:10:19 +00:00
foo dim /*hello*/;
bar dim /*world*/;
swap(foo, bar);
2022-04-18 19:42:26 +00:00
unless (foo = /*world*/) {
2022-02-22 21:49:56 +00:00
/*FAILED*/ print;
/*foo should be 'world', is actually:*/ print;
foo print;
2021-06-13 14:53:33 +00:00
}
2022-04-18 19:42:26 +00:00
unless (foo ain't /*world*/) {
2022-02-22 21:49:56 +00:00
/*OK*/ print;
2021-06-13 14:53:33 +00:00
}