QB64 Phoenix Edition
Interweaving SUB and FUNCTION - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: Official Links (https://qb64phoenix.com/forum/forumdisplay.php?fid=16)
+--- Forum: Learning Resources and Archives (https://qb64phoenix.com/forum/forumdisplay.php?fid=13)
+--- Thread: Interweaving SUB and FUNCTION (/showthread.php?tid=4428)

Pages: 1 2


RE: Interweaving SUB and FUNCTION - SMcNeill - 02-02-2026

The problem with any sorter is keeping a working program flow.

SUB INT
    DEFINT A-Z
END SUB

SUB FOO
   PRINT LEN(x)
END SUB

As is, foo would print 2.  Move foo before Init and it’ll print 4.  Certain commands operate on a simple top-down approach and shuffling code segments can shuffle the application of those commands.  DEF isn’t as common as it used to be, but $IF statements follow this same logic.  Any routine that shuffles subs/functions will have to be tested for these edge cases so it doesn’t break stuff.