Can't make decimal consts?

Blitz3D Forums/Blitz3D Beginners Area/Can't make decimal consts?

Trodd(Posted 2005) [#1]
I have no idea why this won't work!

Was using a constant to set the step size while moving my camera and found it only works when I hard-code the value but when I use a constant. What stupid newbie mistake am I making here?

Even when just trying to print it, it won't work:

Const WholeNumber=1
Const Decimal=0.1


Graphics3D 800,600


While Not KeyHit(1)

	Text 320,500,"Whole numbers work: " + Str(WholeNumber)
	Text 320,550,"..but decimals don't: " + Str(Decimal)
	
Wend



Koriolis(Posted 2005) [#2]
Const Decimal#=0.1


octothorpe(Posted 2005) [#3]
Variables by default are integers. Suffix the variable name with # to make it a float or $ to make it a string. If you want to be explicit, % is an integer. I believe it's only necessary to suffix when you first declare the variable, but some people like to use the variable's suffix throughout their code.

Const foo# = 0.1
Print foo



Trodd(Posted 2005) [#4]
Ah, didn't realise that was needed for consts. *slaps head*


Ross C(Posted 2005) [#5]
It's needed for Global Local, everything. Unless you state the variable type, blitz assumes it's an integer. Mind you:


a = "ross"



Works fine :o)