Can java labels be used appropriately outside of for loops? -
so i've seen lot of cases labels being used in loops break out, doubly nested loops.
is case can used? or there other common uses don't know about. feel java tool i've never used!
it fair labeling loop useful way labeled statement can used.
you are allowed label statement in java, way used target of (labeled) break
or continue
statement.
the usual advice applies though: because can not mean should. don't use labels funny "comments" (yes have seen done). don't write doubly nested loops show off ability break or continue outer loop. these days tend favor operations apply whole sequence, mitigating uses labeled break
s , continue
s. always, aim readability , simplicity. said, tools parser generators output java source quite make heavy use of labeled statements, if human programmers do.
Comments
Post a Comment