forked from AbleScript/ablescript
24 lines
350 B
Plaintext
24 lines
350 B
Plaintext
owo Pass-by-reference test
|
|
|
|
owo Swap two variables.
|
|
functio swap(left, right) {
|
|
var tmp = left;
|
|
left = right;
|
|
right = tmp;
|
|
}
|
|
|
|
var foo = /*hello*/;
|
|
var bar = /*world*/;
|
|
|
|
swap(foo, bar);
|
|
|
|
if (foo != /*world*/) {
|
|
/*FAILED*/ print;
|
|
/*foo should be 'world', is actually:*/ print;
|
|
foo print;
|
|
}
|
|
|
|
if (foo == /*world*/) {
|
|
/*OK*/ print;
|
|
}
|