local.bmx 334 B

12345678910111213
  1. Rem
  2. Local defines a variable as local to the Method or Function it is defined meaning it is automatically released when the function returns.
  3. End Rem
  4. Function TestLocal()
  5. Local a
  6. a=20
  7. print "a="+a
  8. Return
  9. End Function
  10. TestLocal
  11. print "a="+a 'prints 0 or if in Strict mode is an error as a is only local to the TestLocal function