Declaring Local and Global in a function

BlitzMax Forums/BlitzMax Programming/Declaring Local and Global in a function

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Core Duo T2500

Time needed for global ops: 2491
Time needed for local ops: 1412

SuperStrict

Global gFloat:Float = 1.25

Delay 500
Print "Time needed for global ops: " + gFloatF()
Delay 500
Print "Time needed for local ops: " + lFloatF()

End 

Function gFloatF:Int()
	
	Local t1:Int = MilliSecs()
	For Local i:Int = 1 To 10000000
		gFloat :* gFloat
	Next
	t1 = MilliSecs() - t1
	Return t1
End Function

Function lFloatF:Int()
	Local lFloat:Float	= 1.25
	Local t2:Int = MilliSecs()
	For Local i:Int = 1 To 10000000
		lFloat :* lFloat
	Next
	t2 = MilliSecs() - t2
	Return t2
End Function


EDIT: Reordered the code to look cleaner and perhaps make more sense.