Hi Alan,
As you already guessed, in Smalltalk, you should always use the square brackets with ifTrue:ifFalse: or varIfTrue:ifFalse:
Expressions within square brackets are not evaluated immediately; in the case of ifTrue:ifFalse: and varIfTrue:ifFalse:, only the expression corresponding to the value of the Boolean receiver will be evaluated and the other will not be evaluated. That is what you are relying on in your first example.
Without the square brackets, both alternatives are evaluated and then one is selected. We recommend that you not rely on this behavior since it depends on behavior specific to the version of the Smalltalk interpreter that Kyma is using.
In your second example, as you suspected, has to do with the order of evaluation: ?rapidRetrigger gets substituted by the Script, but green variables inside blocks are not visible to the Script because the evaluation of the blocks occurs later.
An alternative way to implement your secound example could be:
{?duration hz - (?rapidRetrigger varIfTrue: (2 samp) ifFalse: (0))}
This moves ?duration out of the block and so it is visible to the Script at the same time as ?rapidRetrigger.