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
Else
takes the place of theGOTO alone
statement.In the original code (QuickBASIC) if the
If
block is entered, everything after thenGOTO alone
statement is ignored.If the
If
block is not entered (i.e., a >= 1) then everything after theIf
block is executed.The
Else
statement in the VB.NET code will produce the same behavior. If a < 1, the first block will be executed and theElse
block will be ignored, and the loop will advance to the next increment ofi
.If a >= 1, then the
Else
block 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.