I quite regularly get into a terrible muddle with IFs and wonder why my code doesn't work. This is usually when I am trying to combine two IFs on the same line but I want the ELSE to apply to a specific one of them. Quite often I have a "verbose" flag in my code which if true will print more information, usually I use V% for this. So it might be something like
But it doesn't work as the ELSE is only encountered when V% is false where Z% might still be true.
Sometimes to get round this I split it up into procedures but it always seems a bit of a "waste" to have to do that...
Code:
IF V% THEN IF Z% PRINT "Z% is True": Do Z% thing ELSE P."Z% is False": Do Not-Z%-thingSometimes to get round this I split it up into procedures but it always seems a bit of a "waste" to have to do that...
Code:
IF Z% PROC Zistrue ELSE PROCZisfalse...DEFPROCZistrueIFV% PRINT "Z is true"Do Z thingENDPROC...DEFPROCZisfalseIFV% PRINT "Z is false"Do not-Z thing ENDPROCStatistics: Posted by BeebMaster — Mon Dec 08, 2025 5:34 pm