? Optimizing Expressions ● SmileBASIC Source

Sign In

*Usernames are case-sensitive
Forgot my password

Optimizing Expressions

SmileBASIC will automatically optimize parts of expressions that use numerical constants and operators. This means you can write code like this: FOR I=0 TO 16-1 ... 'and it won't be any slower than: FOR I=0 TO 15 ... Note that SB will not use mathematical simplification. For example: X*2*3 'will not simplify to X*6 To make SB simplify it, the multiplication of 2*3 must be done first, either X*(2*3) or 2*3*X Logical and comparison operators are not simplified (&& || > < >= <= == !=), nor are any string operations (string+string, string*number).
2 votes
2 Comment(s) MZ952 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Drawing I like to draw! Hobbies Reading I like to read books! Hobbies What about functions like SQR(2) or POW(5,4)? 12Me21 12Me21 Admin Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself Second Year My account is over 2 years old Website Unfortunately, no.