Quick tips

BlitzMax Forums/BlitzMax Beginners Area/Quick tips

some more info to do with globals, and consts

a global in a function.
function keeptrackofsomething()
   global tracker:int
  traker:+1
  print tracker
end function

is global to that function, ie if you call the function 5 times you will get
1
2
3
4
5
printed out.
but any code outside the function can't change that varible.

function coolfeature()
 const coolfactor = 1000
 print coolfactor
end function

coolfeature()
print coolfactor


this will result in the
1000 and 0 being printed.

this lets you have vars that are only constant to a function, not the whole code.

cool eh?