Weird question~ B+ (fonctions)

Blitz3D Forums/Blitz3D Beginners Area/Weird question~ B+ (fonctions)

Apollonius(Posted 2003) [#1]
If u make a fonctions, and u put the fonction at the end of all ur code can u still use it anywhere or do u need to make it at the top as the code is read from top to bottom?

and

if i wanted to make a fonction
that does this:
For layer=0 To 2
For y=0 To 5
For x=0 To 5

AND U CAN ENTER UR CODE HERE

Next
Next
Next


How would I do?

EDITED: Question can u call a variable example: Global Var01
or we cant use Numbers for variables?


soja(Posted 2003) [#2]
1) You can put function blocks anywhere you wish throughout your main code. It does not have to be "prototyped".

2) You can use numbers in variable names, as long as it doesn't start with one.

All you have to do is try them and see


keyboard(Posted 2003) [#3]
here is an example of putting in a simple function


Graphics 800,600;set graphics mode
SetBuffer BackBuffer();set buffer
While Not KeyHit(1);while not esc key
	MYFUNCTION();go to your function
	Color 0,0,0
	Rect 400,400,300,20,1
	Color 255,255,255
	Text 410,403,"press ESC to leave the snowstorm"
	Flip
Wend
End;end game

Function MYFUNCTION()
	Color 255,255,255
	For layer=0 To 2
		For y=0 To 5
			For x=0 To 5
				Plot Rand(0,800),Rand(0,600)			
			Next
		Next
	Next
End Function



ps: if you write "you" instead of "u" then it is easier for people who don't read English so well, all sorts of people read the posts.