? 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).
3 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 Head Admin Video Games I like to play video games! Hobbies First Year My account is over 1 year old Website Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength Unfortunately, no.