I'm reverse engineering in QuickBasic and I have code like this:
FOR i = star TO fin
IF a < 1 THEN
CALL clrbot
COLOR 15
PRINT force$(side); " army in "; city$(armyloc(i)); " is CUT OFF !";
TICK turbo!
GOTO alone
END IF
size = size + 1
max = 11: IF LEN(armyname$(i)) < 11 THEN max = LEN(armyname$(i))
mtx$(size) = LEFT$(armyname$(i), max)
array(size) = i
alone:
NEXT i
I'd like to get rid of the line label (alone) and instead do something like:
IF a < 1 THEN
CALL clrbot
COLOR 15
PRINT force$(side); " army in "; city$(armyloc(i)); " is CUT OFF !";
TICK turbo!
NEXT i
END IF
You could replace the GOTO with an Else:
This would follow the same logic - the
Elsetakes the place of theGOTO alonestatement.In the original code (QuickBASIC) if the
Ifblock is entered, everything after thenGOTO alonestatement is ignored.If the
Ifblock is not entered (i.e., a >= 1) then everything after theIfblock is executed.The
Elsestatement in the VB.NET code will produce the same behavior. If a < 1, the first block will be executed and theElseblock will be ignored, and the loop will advance to the next increment ofi.If a >= 1, then the
Elseblock will be executed and the loop will then advance to the next increment ofi.The above assumes labels in QuickBASIC are like labels in DOS batch files.