LoginLogin
Nintendo shutting down 3DS + Wii U online services, see our post

System Variables are not "variables"

Root / Submissions / [.]

snail_Created:
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.

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.

Replying to:snail_
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.
#YES and #OK are much better lol. Though !-. is pretty good too.

Ok so it's been like 7 years and we know more about SB now Yes system vars are variables; they use the same addressing mode in the compiled bytecode. Also: VAR MAINCNT is a duplicate variable error You can use VAR MAINCNT in a function, which creates a local variable that is completely separate from the global system var. VAR( and CHKVAR just only check user defined variables (maybe this is a bug, or maybe it's intentional. it's hard to tell especially when VAR() isn't even documented)

Replying to:snail_
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.
I hereby denounce my use of TRUE in favor of #TRUE

Replying to:snail_
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.
R.I.P. TRUE

Replying to:snail_
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.
ohmigosh 12Em43 im ur biggest fan i luv u everything is fair in the love of 15You32 will u marry mi sozz please

Replying to:snail_
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.
bananana why are you acting so weird?

Replying to:snail_
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.
because im fucking stupid and i dont know what to do with my fucking life

Replying to:snail_
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.
What? Why would you ever think that? That is, if you actually think that and aren't just trying to joke around.

Replying to:snail_
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.
oh-