Goto vs if/esle
-
Bad enough its VB, they are even using a select for two cases when an Or would have sufficed.
Select Case stringvalue.ToLower
Case "a", "b"
rslt = Format(CDbl(AmountB), "#,0.00")
GoTo skpy
If CheckPPSO Or CheckPRS Then
If DownPayment >= Downpayment_Cutoff Then
If CountryAbbr = "CA" Then
rslt = Format(GetPrice(CodeLetter, "XYZ"), "#,0.00")
Else
rslt = Format(GetPrice(CodeLetter, "X"), "#,0.00")
End If
End If
skpy:
End If
End SelectThis was in the middle of a larger switch with 246 case statements. Good thing it's Friday, I've stopped processing data after coming to this. Why are people who do this even allowed near computers :-D :rolleyes:
No comment
-
Bad enough its VB, they are even using a select for two cases when an Or would have sufficed.
Select Case stringvalue.ToLower
Case "a", "b"
rslt = Format(CDbl(AmountB), "#,0.00")
GoTo skpy
If CheckPPSO Or CheckPRS Then
If DownPayment >= Downpayment_Cutoff Then
If CountryAbbr = "CA" Then
rslt = Format(GetPrice(CodeLetter, "XYZ"), "#,0.00")
Else
rslt = Format(GetPrice(CodeLetter, "X"), "#,0.00")
End If
End If
skpy:
End If
End SelectThis was in the middle of a larger switch with 246 case statements. Good thing it's Friday, I've stopped processing data after coming to this. Why are people who do this even allowed near computers :-D :rolleyes:
No comment
-
Bad enough its VB, they are even using a select for two cases when an Or would have sufficed.
Select Case stringvalue.ToLower
Case "a", "b"
rslt = Format(CDbl(AmountB), "#,0.00")
GoTo skpy
If CheckPPSO Or CheckPRS Then
If DownPayment >= Downpayment_Cutoff Then
If CountryAbbr = "CA" Then
rslt = Format(GetPrice(CodeLetter, "XYZ"), "#,0.00")
Else
rslt = Format(GetPrice(CodeLetter, "X"), "#,0.00")
End If
End If
skpy:
End If
End SelectThis was in the middle of a larger switch with 246 case statements. Good thing it's Friday, I've stopped processing data after coming to this. Why are people who do this even allowed near computers :-D :rolleyes:
No comment
-
Bad enough its VB, they are even using a select for two cases when an Or would have sufficed.
Select Case stringvalue.ToLower
Case "a", "b"
rslt = Format(CDbl(AmountB), "#,0.00")
GoTo skpy
If CheckPPSO Or CheckPRS Then
If DownPayment >= Downpayment_Cutoff Then
If CountryAbbr = "CA" Then
rslt = Format(GetPrice(CodeLetter, "XYZ"), "#,0.00")
Else
rslt = Format(GetPrice(CodeLetter, "X"), "#,0.00")
End If
End If
skpy:
End If
End SelectThis was in the middle of a larger switch with 246 case statements. Good thing it's Friday, I've stopped processing data after coming to this. Why are people who do this even allowed near computers :-D :rolleyes:
No comment
-
I don't code in VB, so I could be well off the mark here, but isn't that GoTo also going to take you to a point where your next statment is "End If", without having actually executed the corresponding "If"? Couldn't that have "interesting" effects?
Its probably safe in that sense, the compiler will most likely just put make the
End If
the target of a Jump instruction. For a loop, it would be horrible. In C++, that could cause RAII to break, but in VB its probably safe. No guarantees though (but where GOTO's are used, most guarantees are probably invalid anyway). -
Its probably safe in that sense, the compiler will most likely just put make the
End If
the target of a Jump instruction. For a loop, it would be horrible. In C++, that could cause RAII to break, but in VB its probably safe. No guarantees though (but where GOTO's are used, most guarantees are probably invalid anyway).