[Gambas-user] Ambiguous expression using \ integer divide

Brian G brian at westwoodsvcs.com
Fri Nov 10 17:03:58 CET 2023


Why does this expression work 

? eval("15393 / 1000 * 1000 + 14") 
15407 

and this one fail : 

? eval("15393 \\ 1000 * 1000 + 14") 
error:Ambiguous expression. Please use brackets 

? eval("(15393 \\ 1000) * 1000 + 14") 
15014 

Should not \ and / have the same precedence in an expression except using integer math rather than floating point? 


"Failure is the key to success; 
each mistake teaches us something" .. Morihei Ueshiba 
Brian G 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20231110/60ebb248/attachment.htm>


More information about the User mailing list