I understand that it is difficult to untangle a mixture of arithmetic and boolean expressions. A boolean function, however, would do the job, and would be easy to implement. Example:
Code: Select all
result = Boolean(X > Y) * value
Code: Select all
result = Boolean(X > Y) * value
I just discovered your solution.Kaeru Gaman wrote:Code: Select all
a = 7 b = 5 Debug #False Or (a>b)
Code: Select all
Macro Is(boolean)
(#False Or (boolean))
EndMacro
Debug Is(12 < 13) * 22
Debug 5* Is(100 = 99+3 Or 7 > 4)
Debug Is(x) * 9
Code: Select all
Macro Is(boolean)
(boolean)
EndMacro
Actually, this work-around is based on the fact that Fred takes an expression as boolean, as soon as the boolean operators AND,OR, NOT are used in the expression. (At least that's how it seems to be). Examples:Dare2 wrote: Is the "#False or" required for some cases ...
Code: Select all
Debug (12 = 22 Or 5 > 3) * 22
Debug (100 = 99+1 Or d > 8) *5
I guess (hope), if Fred will change this at all, he will support a boolean function, like IS(BooleanExpression). This would be a clean solution, and should not be complicated, because the complete evaluation procedure exists already.blueznl wrote:and pretty dangerous, as fred has stated this is not supported, so it may be broken at any time in the future...
I think PB should evaluateI guess (hope), if Fred will change this at all, he will support a boolean function
Code: Select all
(a > 60)
Code: Select all
If (a > 60) ...
Code: Select all
(a > 60)
Code: Select all
DisableGadget(#gg, a>60)
Code: Select all
If a > 60
DisableGadget(#gg, #True)
Else
DisableGadget(#gg, #False)
EndIf
Code: Select all
Procedure b2i(e.l)
If e: ProcedureReturn 1: EndIf
ProcedureReturn 0
EndProcedure
...
DisableGadget(#myGadget, b2i(anum <> 0))
...