Language: label, break, continue, goto

发布时间 2023-04-09 20:30:00作者: ascertain

 

C

goto

  1. Must be defined within a function
  2. Each label in one function must have a unique name. It cannot be a reserved C keyword
  3. C has a separate namespace for labels, so you can use the same name for a variable and a label
  4. Must be followed by a statement. We call it a `labeled statement`
  5. Has function scope, Therefore the label:
    • Must have a unique name within that function
    • Is not accessible outside the function, where it was defined

 

 

 

 

    

 

Java

goto is a  reserved word in Java. Java supports label, the only place where a label is useful in Java is right before nested loop statements, label name can be specified with break and continue

 

 

 

 

 

 

 

 

Go