What command should I use to make my program pause until the user presses a key? - Printable Version +- Small Basic Forum (https://litdev.uk/mybb) +-- Forum: Small Basic (https://litdev.uk/mybb/forumdisplay.php?fid=1) +--- Forum: Standard Small Basic (https://litdev.uk/mybb/forumdisplay.php?fid=2) +--- Thread: What command should I use to make my program pause until the user presses a key? (/showthread.php?tid=93) |
RE: What command should I use to make my program pause until the user presses a key? - WhTurner - 06-30-2024 Hi Elzaimer, Your problem is caused by using a "non-english" environment. This causes the output of a calculation with a floating answer with a , (comma) in it. But if you reuse this figure in a calculation the comma is not accepted as a decimal sign but as a string. So SommeDesEcartsALaMoyenne concatenates the answers. A solution can be: if you use the LitDev extension by placing LDUtilities.CurrentCulture="en-US" as the first line. Or you can do the calculation with integers by multiplying with 10000 and rounding. For the display multiply with 0.00001 RE: What command should I use to make my program pause until the user presses a key? - Elzaimer - 06-30-2024 (06-30-2024, 11:42 AM)litdev Wrote: In Small Basic, whether a variable is treated as number or array or string is context dependent. The operator + works on all data types with precedence left to right. Thanks for these very usefull explanations. I put the line "SommeDesEcartsALaMoyenne = 0" at the top of my program and now it works ! So we have to define the types of the variables by puting xxx = 0 or xxx = "" at the begining of the programs okkkay ! (06-30-2024, 12:37 PM)WhTurner Wrote: Hi Elzaimer, I tried LitDev's solution which was easier for me, but your answer is very interesting. |