? System Variables are not "variables" ● SmileBASIC Source

Sign In

*Usernames are case-sensitive
Forgot my password

System Variables are not "variables"

A system variable is not defined and stored as a proper variable the same way all other vars are. For example, CHKVAR will always return false (0) for a system variable—even a writeable one. In addition, accessing a system variable through functional VAR will throw Undefined variable. Take the following prompt as an example (lines starting with > are DIRECT input, all others are output.) >PRINT CHKVAR("MAINCNT") 0 OK >PRINT VAR("CSRX") Undefined variable OK >VAR A%=10 OK >PRINT CHKVAR("A%") 1 OK >PRINT VAR("A%") 10 OK This leads to the conclusion that system variables are specially compiled keywords and not variables which point to some static system value; even writeable ones probably compile to a special assignment instruction when writing. This also possibly confirms the suspicion that TRUE and FALSE are complied keywords which simply represent 1 and 0, instead of being true variables themselves, making their associated constants redundant.
3 votes
  • system
  • variable
  • docs
  • spec
2 Comment(s) snail_ snail_ Helper Received for being very helpful around SmileBASIC Source Achievements First Day Joined on the very first day of SmileBASIC Source Website Night Person I like the quiet night and sleep late. Express Yourself I hereby denounce my use of #TRUE in favor of TRUE. Semantics and best practice wins. Speed tests between both demonstrate they both run at the same speed. 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 #YES and #OK are much better lol. Though !-. is pretty good too.