This sounds like something fun to experiment with, once I have free time again. I think, with a little effort, one could “future proof” their EXE.
Say in your current example, your program only has 4 tasks which you’ve defined as subs.
Now, you want to make it so this same program might work with 10 tasks, in the future...
One trick would be to compile the 4 tasks as a DLL, with 6 stubs of blank tasks for future expansion. Then you DECLARE LIBRARY the DLL and reference all 10 tasks, including the stubs.
Now you can write your select case:
SELECT CASE task_level
CASE 1: Task1
CASE 2: Task2
CASE 3: Task3
CASE 4: Task4
CASE 5: Task5
... and so on....
Now, just because you only have code which utilizes 4 tasks now, that doesn’t mean you can’t expand the DLL and add new tasks later, just by replacing those blank stubs.
One place I could see this type of future expandability might be for a calculator app. You might start off with the DLL just doing the most basic of stuff, like +-*/, but then expand later to do ^,%, and !
Instead of having to edit and recompile the whole EXE over, all you’d have to do is rebuild the DLL and replace it.
Honestly, I think most folks would just keep it simple and recompile to another EXE version, but I like the concept of future compatibility — especially for custom scripting sublanguages and such.