Bad programming style

Blitz3D Forums/Blitz3D Programming/Bad programming style

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.

AlmoAtAcclaim has it!

If we branch out of a loop with 'goto' then we hav'nt really left the loop at all. The thing to do is exit each loop (if nested) with `exit` and then exit the function with 'return'

Function Funky(StartFrom,FinishAt,Exclude)

;Loop from start to finish
;Exit if loop range includes exclusion value and return exclusion value

For xloop=StartFrom to FinishAt
IF xloop=Exclude then Exit
Next
If Not XLoop>FinishAt then
Return XLoop
End if
Return

End Function