It's the scope. As soon as your (loop) body ends, the variables value is not guaranteed to be valid anymore. So in the next iteration of the loop, the value is again undefined and you have to initialize it again.

Code:
action super_thing()
{
  while(1)
  { // Boop is "allocated" here
    var Boop; // Boop is undefined here
    Boop+=1*time_step; // add something to an undefined value will result in an undefined value
  } // Boop is "invalidated" here
}



If you want to change a variable over multiple operations (like in the code example), you need to do this:

Code:
action super_thing()
{ // Boop is "allocated" here
  var Boop = 0; // Boop is defined here
  while(1)
  {
    Boop+=1*time_step; // add something iteratively to the initially defined value
  }
} // Boop is "invalidated" here



Visit my site: www.masterq32.de