Gosub or functions?

Blitz3D Forums/Blitz3D Beginners Area/Gosub or functions?

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.

repeat
  DrawPlayer()
forever


seems clear to me.. not less clear than:

repeat
  Gosub DrawPlayer
forever


I've no problems anymore with includes since I know how to make my own stuff highlight using that declr trick.

and what about:

repeat
  DrawPlayer(100,100)
forever


compared to:

repeat
  PlayerX=100:PlayerY=100:gosub DrawPlayer
forever


The main reason I like functions over gosubs is that functions look like other commands. Imagine the Rect command using a gosub:

RectX=0:RectY=0:RectWIdth=100:RectHeight=40:RectFill=true:gosub Rect

I use long variablenames since they need to be globals, and common stuff like x and y are usually already in use.

and now as a function:

Rect 0,0,100,40,true

By using functions all stuff looks uniform.

... 2ct.