Is there a way to have an expression be evaluated immediately in an assignment? E.g.
forall $i in 3 {
let $receiver := "OneOfTwo"+(($i%2)+1)
print intended receiver ($receiver)
($somedelay)ms @command($receiver) dosomething
print invoked receiver ($receiver)
let $somedelay := @rand(100)
}
prints
intended receiver OneOfTwo1
invoked receiver OneOfTwo1
intended receiver OneOfTwo2
intended receiver OneOfTwo1
invoked receiver OneOfTwo1
invoked receiver OneOfTwo1
instead of alternating OneOfTwo1 and OneOfTwo2.
Is there a way to force the assignment of the value of expression instead of the expression itself, similar to delimiting an expression by putting it into round brackets?
Of course, the above example could be rewritten into something like that:
forall $i in 3 {
let $receiver := "OneOfTwo"+(($i%2)+1)
if ($receiver = "OneOfTwo1") {
($somedelay)ms OneOfTwo1 dosomething
} else {
($somedelay)ms OneOfTwo2 dosomething
}
let $somedelay := @rand(100)
}
However, it would be convenient to be able to force evaluation on assignment, as there are other use cases for that (I could give other examples) which are not reformulated so easily.