What is %?

BlitzMax Forums/BlitzMax Beginners Area/What is %?

BLaBZ(Posted 2011) [#1]
What does % mean when declaring a variable?

For example:
Global curGetKey%



therevills(Posted 2011) [#2]
Its a symbol which means Integer:

% = Int
# = Float
$ = String
! = Double

Shortcuts really :P

Last edited 2011


Zeke(Posted 2011) [#3]
also:
Type TMyType
	Field a@	'byte
	Field b@@	'short
	Field c%	'int
	Field d%%	'long
	Field e#	'float
	Field f##	'double
	Field g!	'double
	Field h$	'string
End Type

Local id:TTypeId=TTypeId.ForName( "TMyType" )

For Local fld:TField=EachIn id.EnumFields()
   Print fld.Name()+":"+fld.TypeId().Name()
Next



Czar Flavius(Posted 2011) [#4]
Each person has his own style, but personally I prefer to avoid using these symbols. I program in Strict mode, so a variable without a type defaults to int so there is no extra typing anyway, as most variables are int.


dawlane(Posted 2011) [#5]
Plus programming in strict mode saves a lot of time debugging (traps typing errors with different variable types). It's best to stay away from cryptic symbols as byte,short,int,long, etc is more readable than @,@@,%,%%, etc.