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

Values Starting With A Hash (like #TBLUE)

Root / FAQs / [.]

🔒
_Nyap_Created:
are they basically pre-defined symbolic constants? and if so, can I define my own?

They're like variables you can't change. Constants values with symbolic names. "pre-defined symbolic constants" is right. Sadly, you CAN'T create them, which would be very nice speed-wise.

They're like variables you can't change. Constants values with symbolic names. "pre-defined symbolic constants" is right. Sadly, you CAN'T create them, which would be very nice speed-wise.
well in the C++ world, a constant is a fixed value a literal constant is just a value, like "Hello World!" or 69 a symbolic constant is a variable with a fixed value. the value has to be provided upon creation

They're like variables you can't change. Constants values with symbolic names. "pre-defined symbolic constants" is right. Sadly, you CAN'T create them, which would be very nice speed-wise.
well in the C++ world, a constant is a fixed value a literal constant is just a value, like "Hello World!" or 69 a symbolic constant is a variable with a fixed value. the value has to be provided upon creation
Yes. If you tried to define a 'variable with a fixed value,' all you need is to define a variable and give it a value that you don't change. I don't think they can compile as constant though. The #whatever constants are compiled into the actual values they represent and are actually 'constant.'

Yeah, things like #TBLUE are constant literals, not constant variables. They compile to their value, which you can check by typing # and using the help menu. You can't define your own, but if you care enough you could contact them as a feature request. Constants were introduced in version 3.2.0.

oops @Minxrod sorry I just realized I read your post wrong That's why I was lecturing you on the difference between a symbolic constant and literal xD
what I read"pre-defined symbolic constants" isn't right.
what it actually says"pre-defined symbolic constants" is right.

It would be nice if we could make our own as a sort of preprocessor function.
CONST LOLOL=420
PRINT #LOLOL
Which would run through the preprocessor and compile to something along the lines of
PRINT 420
Great for speed. Then we could define constants like E or Pi
CONST PI=PI()
CONST E=EXP(1)
PRINT #PI
PRINT #E
which would come out looking like
PRINT 3.14159265359
PRINT 2.71828182846

That would be useful, yes.
const(#PI,3.1415)
print #PI
save "PRG1:PI#

RUN

file to compile: PI
done

save as: PIPI

exec "PRG0:PIPI"
3.1415

I suppose you could use it for really long numbers. It would make typing that annoying 8 digit number 5 times sooo much easier.
const(#number,15637253)
if #n==b>5*4 then
...
elseif #n/score>g
...
...
...
etc...