06-30-2024, 11:42 AM
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.
Consider the following examples.
In your code I would also initialise SommeDesEcartsALaMoyenne to 0 before it is added to. SB does assume variables are "" or 0 initially, but good practice to initialise something before you use it. Also your SD calculation is unusual, usually it would be RootMeanSquare.
Consider the following examples.
Code:
TextWindow.WriteLine(1+2)
TextWindow.WriteLine(1+2+"A")
TextWindow.WriteLine("A"+1+2)
TextWindow.WriteLine(Text.Append(1,2)+"A")
In your code I would also initialise SommeDesEcartsALaMoyenne to 0 before it is added to. SB does assume variables are "" or 0 initially, but good practice to initialise something before you use it. Also your SD calculation is unusual, usually it would be RootMeanSquare.