that second idea is a good one. You could leave all the debugprints in place and use them only as needed.
I have currently made myself a Debug function which handles that, where first line is:
if debugprinting = false then return
What comes to your first suggestion, it would rather suggest possiblity of using something like:
Code: Select all
switch
case 1 or case 2
x=1
case 3
x=2
endswitch
problem with your suggested:
is both in readability and also in case you wish some case not to do nothing, you might still want it to be listed in code so you can see that this case is not just forgotten, but because it is not doing anything, as example:
Code: Select all
case1:
/*do nothing*/
case 2:
x=1
case 3:
x=2
in case like this comment would be ignored and case 1 and 2 would both become x in your example.
Another porssibility would be to be able to control how switch works.
For sometimes it is useful if case jumps from one case to other, as example:
Code: Select all
case1:
a=a+1
case2:
a=a+1
case3:
a=a+1
At start a = 0
if case is 1, a would become 3 since it goes through all the cases.
If case is 3, then a would become 1, since it would only do case three, not the previous ones.
And then there would also be needed additional command to stop the flow:
Code: Select all
case 1:
a=a+1
case 2:
a=a+1
end case
case 3:
a=a+1
in this case, case 1 would make a become 2, as only case 1 and 2 would be executed.