268:. Case labels are used to associate an integer value with a statement in the code. When a switch statement is reached, program execution continues with the statement after the case label with value that matches the value in the parentheses of the switch. If there is no such case label, but there is a default label, program execution continues with the statement after the default label. If there is no default label, program execution continues after the switch.
429:, the integer constant associated with each case label must be unique. There may or may not be a default statement. There is no restriction on the order of the labels within a switch. The requirement that case labels values evaluate to integer constants gives the compiler more room for optimizations.
119:
Function labels consist of an identifier, followed by a colon. Each such label points to a statement in a function and its identifier must be unique within that function. Other functions may use the same name for a label. Label identifiers occupy their own namespace – one can have
105:
a label identifies a statement in the code. A single statement can have multiple labels. Labels just indicate locations in the code and reaching a label has no effect on the actual execution.
970:, the former of which labels the object immediately following it, the latter refers to its evaluated value. Labels in this sense constitute rather an alternative to variables, with
1658:
1494:
1469:
1021:
Apart from that, some forms permit or mandate the declaration of a label for later referral, including the special form
776:
special operator. Distinguishing its usage from many other programming languages that permit global navigation, such as
1540:
44:
32:
74:
121:
264:, followed by an expression that evaluates to integer constant. A default label consists of the keyword
1622:
1559:
1601:
777:
102:
1580:
1520:
1653:
69:
63:
1648:
260:
Two types of labels can be put in a switch statement. A case label consists of the keyword
20:
8:
40:
443:
54:
426:
255:
85:, support numeric labels. Labels are also used to identify an entry point into a
1498:
1473:
58:
780:, the labels are only accessible in the context of this operator. Inside of a
1642:
1544:
1449:
769:
36:
28:
1033:
clause. Immediate departure from a named form is possible by using the
125:
90:
990:
designates a chosen unsigned decimal integer identifying the label.
16:
Sequence of characters that identifies a location within source code
86:
246:, program execution continues with the statement after the label.
788:
special form permits a transfer of control between these labels.
78:
242:
can be used to jump to a labeled statement in the code. After a
772:
two ways of defining labels exist. The first one involves the
27:
is a sequence of characters that identifies a location within
82:
239:
114:
49:
47:, the purpose of a label is to act as the destination of a
784:
labels are defined as forms starting with a symbol; the
77:
and its derived variations. Some languages, such as
31:. In most languages, labels take the form of an
1640:
1470:"C Standard section 6.8.6.1 The goto statement"
1623:"CLSH: Macro TYPECASE, CTYPECASE, ETYPECASE"
978:declaring and initializing a “variable” and
954:A second method utilizes the reader macros
675:statement to break out of the code blocks:
1541:"Differences Between GW-BASIC and QBasic"
446:statements may be preceded by the label:
1620:
1599:
1578:
1557:
1641:
1201:In a fashion similar to C, the macros
61:can (for example, as the operand of a
1533:
1518:
89:sequence of statements (e.g., during
1025:which prescribes a naming, and the
13:
1029:macro that can be identified by a
108:
14:
1670:
1497:. Microsoft. 1988. Archived from
57:, labels can be used anywhere an
1602:"CLHS: Macro CASE, CCASE, ECASE"
1560:"CLHS: Special Operator TAGBODY"
249:
457://Label the outermost for-loop.
128:with the same name as a label.
1614:
1593:
1572:
1551:
1512:
1487:
1462:
1314:"three four or five"
986:accessing it. The placeholder
763:
1:
1659:Programming language concepts
1455:
437:
1495:"GOTO Statement QuickSCREEN"
238:is the label. The statement
7:
1443:
1332:"any other value"
432:
10:
1675:
1435:"any other type"
1225:define switch statements.
253:
112:
670:
1339:
1227:
1121:
1039:
992:
790:
677:
669:It also possible to use
448:
270:
130:
752:// Which would output:
442:In JavaScript language
73:instruction). Also in
35:, often followed by a
1581:"CLHS: Section 2.4.8"
217:"Invalid number!
37:punctuation character
21:programming languages
1417:"a number"
1399:"a string"
96:
45:high-level languages
1521:"nasm x86 Assembly"
1381:"a list"
1037:special operator.
1004:"hello"
55:assembly language
1666:
1633:
1632:
1630:
1629:
1618:
1612:
1611:
1609:
1608:
1597:
1591:
1590:
1588:
1587:
1576:
1570:
1569:
1567:
1566:
1555:
1549:
1548:
1543:. Archived from
1537:
1531:
1530:
1528:
1527:
1516:
1510:
1509:
1507:
1506:
1491:
1485:
1484:
1482:
1481:
1472:. Archived from
1466:
1439:
1436:
1433:
1430:
1427:
1424:
1421:
1418:
1415:
1412:
1409:
1406:
1403:
1400:
1397:
1394:
1391:
1388:
1385:
1382:
1379:
1376:
1373:
1370:
1367:
1364:
1361:
1358:
1355:
1352:
1349:
1346:
1343:
1336:
1333:
1330:
1327:
1324:
1321:
1318:
1315:
1312:
1309:
1306:
1303:
1300:
1297:
1294:
1291:
1288:
1285:
1282:
1279:
1276:
1273:
1270:
1267:
1264:
1261:
1258:
1255:
1252:
1249:
1246:
1243:
1240:
1237:
1234:
1231:
1224:
1220:
1216:
1212:
1208:
1204:
1197:
1194:
1191:
1188:
1185:
1182:
1179:
1176:
1173:
1170:
1167:
1164:
1161:
1158:
1155:
1152:
1149:
1146:
1143:
1140:
1137:
1134:
1131:
1128:
1125:
1118:
1115:
1112:
1109:
1106:
1103:
1100:
1097:
1094:
1091:
1088:
1085:
1082:
1079:
1076:
1073:
1070:
1067:
1064:
1061:
1058:
1055:
1052:
1049:
1046:
1043:
1036:
1032:
1028:
1024:
1017:
1014:
1011:
1008:
1005:
1002:
999:
996:
985:
977:
969:
961:
950:
947:
944:
941:
938:
935:
932:
929:
926:
923:
920:
917:
914:
911:
908:
905:
902:
899:
896:
893:
890:
887:
884:
881:
878:
875:
872:
869:
866:
863:
860:
857:
854:
851:
848:
845:
842:
839:
836:
833:
830:
827:
824:
821:
818:
815:
812:
809:
806:
803:
800:
797:
794:
787:
783:
775:
759:
756:
753:
750:
747:
744:
741:
738:
735:
732:
729:
726:
723:
720:
717:
714:
711:
708:
705:
702:
699:
696:
693:
690:
687:
684:
681:
674:
673:
665:
662:
659:
656:
653:
652:", j="
650:
647:
644:
641:
638:
635:
632:
629:
626:
623:
620:
617:
614:
611:
608:
605:
602:
601:", j="
599:
596:
593:
590:
587:
584:
581:
578:
575:
572:
569:
566:
563:
560:
557:
554:
551:
548:
545:
542:
539:
536:
533:
530:
527:
524:
521:
518:
515:
512:
509:
506:
503:
500:
497:
494:
491:
488:
485:
482:
479:
476:
473:
470:
467:
464:
461:
458:
455:
452:
427:switch statement
425:Within a single
421:
418:
415:
412:
409:
406:
403:
400:
397:
394:
391:
388:
385:
382:
379:
376:
373:
370:
367:
364:
361:
358:
355:
352:
349:
346:
343:
340:
337:
334:
331:
328:
325:
322:
319:
316:
313:
310:
307:
304:
301:
298:
295:
292:
289:
286:
283:
280:
277:
274:
267:
263:
256:Switch statement
245:
230:
227:
224:
221:
218:
215:
212:
209:
206:
203:
200:
197:
194:
191:
188:
185:
182:
179:
176:
173:
170:
167:
164:
161:
158:
155:
152:
149:
146:
143:
140:
137:
134:
72:
66:
52:
1674:
1673:
1669:
1668:
1667:
1665:
1664:
1663:
1639:
1638:
1637:
1636:
1627:
1625:
1619:
1615:
1606:
1604:
1598:
1594:
1585:
1583:
1577:
1573:
1564:
1562:
1556:
1552:
1539:
1538:
1534:
1525:
1523:
1517:
1513:
1504:
1502:
1493:
1492:
1488:
1479:
1477:
1468:
1467:
1463:
1458:
1446:
1441:
1440:
1437:
1434:
1431:
1428:
1425:
1422:
1419:
1416:
1413:
1410:
1407:
1404:
1401:
1398:
1395:
1392:
1389:
1386:
1383:
1380:
1377:
1374:
1371:
1368:
1365:
1362:
1359:
1356:
1353:
1350:
1347:
1344:
1341:
1338:
1337:
1334:
1331:
1328:
1325:
1322:
1319:
1316:
1313:
1310:
1307:
1304:
1301:
1298:
1295:
1292:
1289:
1287:"two"
1286:
1283:
1280:
1277:
1274:
1271:
1269:"one"
1268:
1265:
1262:
1259:
1256:
1253:
1250:
1247:
1244:
1241:
1238:
1235:
1232:
1229:
1222:
1218:
1214:
1210:
1206:
1202:
1199:
1198:
1195:
1192:
1189:
1186:
1183:
1180:
1177:
1174:
1171:
1168:
1165:
1162:
1159:
1156:
1153:
1150:
1147:
1144:
1141:
1138:
1135:
1132:
1129:
1126:
1123:
1120:
1119:
1116:
1113:
1110:
1107:
1104:
1101:
1098:
1095:
1092:
1089:
1086:
1083:
1080:
1077:
1074:
1071:
1068:
1065:
1062:
1059:
1056:
1053:
1050:
1047:
1044:
1041:
1034:
1030:
1026:
1022:
1019:
1018:
1015:
1012:
1009:
1006:
1003:
1000:
997:
994:
979:
971:
963:
955:
952:
951:
948:
945:
942:
939:
936:
933:
930:
927:
924:
921:
918:
915:
912:
909:
906:
903:
900:
897:
894:
891:
888:
885:
882:
879:
876:
873:
870:
867:
864:
861:
858:
855:
852:
849:
846:
843:
840:
837:
834:
831:
828:
825:
822:
819:
816:
813:
810:
807:
804:
801:
798:
795:
792:
785:
781:
773:
766:
761:
760:
757:
754:
751:
748:
745:
743:"baz"
742:
739:
736:
733:
730:
727:
724:
721:
719:"bar"
718:
715:
712:
709:
706:
703:
701:"foo"
700:
697:
694:
691:
688:
685:
682:
679:
671:
667:
666:
663:
660:
657:
654:
651:
648:
645:
642:
639:
636:
633:
630:
627:
624:
621:
618:
615:
612:
609:
606:
603:
600:
597:
594:
591:
588:
585:
582:
579:
576:
573:
570:
567:
564:
561:
558:
555:
552:
549:
546:
543:
540:
537:
534:
531:
528:
525:
522:
519:
516:
513:
510:
507:
504:
501:
498:
495:
492:
489:
486:
483:
480:
477:
474:
471:
468:
465:
462:
459:
456:
453:
450:
440:
435:
423:
422:
419:
416:
413:
410:
407:
404:
401:
398:
395:
392:
389:
386:
383:
380:
377:
374:
371:
368:
365:
362:
359:
356:
353:
350:
347:
344:
341:
338:
335:
332:
329:
326:
323:
320:
317:
314:
311:
308:
305:
302:
299:
296:
293:
290:
287:
284:
281:
278:
275:
272:
265:
261:
258:
252:
243:
232:
231:
228:
225:
222:
219:
216:
213:
210:
207:
204:
201:
198:
195:
192:
189:
186:
183:
180:
177:
174:
171:
168:
165:
162:
159:
156:
153:
150:
147:
144:
141:
138:
135:
132:
117:
111:
109:Function labels
99:
68:
62:
53:statement. In
48:
17:
12:
11:
5:
1672:
1662:
1661:
1656:
1651:
1635:
1634:
1613:
1592:
1571:
1550:
1547:on 2010-02-10.
1532:
1511:
1486:
1460:
1459:
1457:
1454:
1453:
1452:
1445:
1442:
1340:
1228:
1122:
1040:
993:
791:
765:
762:
678:
640:"i="
589:"i="
449:
439:
436:
434:
431:
271:
251:
248:
131:
110:
107:
98:
95:
15:
9:
6:
4:
3:
2:
1671:
1660:
1657:
1655:
1652:
1650:
1647:
1646:
1644:
1624:
1621:Kent Pitman.
1617:
1603:
1600:Kent Pitman.
1596:
1582:
1579:Kent Pitman.
1575:
1561:
1558:Kent Pitman.
1554:
1546:
1542:
1536:
1522:
1515:
1501:on 2009-07-25
1500:
1496:
1490:
1476:on 2007-12-24
1475:
1471:
1465:
1461:
1451:
1448:
1447:
1226:
1038:
991:
989:
983:
975:
967:
959:
789:
779:
771:
676:
447:
445:
430:
428:
300:"invalid
269:
257:
250:Switch labels
247:
241:
237:
129:
127:
123:
116:
106:
104:
94:
92:
88:
84:
80:
76:
71:
65:
60:
56:
51:
46:
42:
38:
34:
30:
26:
22:
1654:Control flow
1626:. Retrieved
1616:
1605:. Retrieved
1595:
1584:. Retrieved
1574:
1563:. Retrieved
1553:
1545:the original
1535:
1524:. Retrieved
1514:
1503:. Retrieved
1499:the original
1489:
1478:. Retrieved
1474:the original
1464:
1200:
1020:
987:
981:
973:
965:
957:
953:
826:'started
767:
668:
441:
424:
259:
235:
233:
118:
100:
43:). In many
24:
18:
1649:Source code
1519:O. Lawlor.
1450:Line number
1175:return-from
1096:return-from
1035:return-from
770:Common Lisp
764:Common Lisp
758:// > bar
755:// > foo
29:source code
1643:Categories
1628:2020-08-20
1607:2020-08-20
1586:2020-08-18
1565:2020-08-18
1526:2008-07-03
1505:2008-07-03
1480:2008-07-03
1456:References
664://i=2, j=3
613://i=2, j=3
565:&&
438:Javascript
402:"even
254:See also:
113:See also:
33:identifier
1426:otherwise
1323:otherwise
1223:etypecase
1219:ctypecase
1193:iteration
1181:'done
1163:iteration
1139:iteration
1114:iteration
1102:'done
1084:iteration
1060:iteration
946:'done
904:iteration
868:iteration
856:iteration
838:iteration
802:iteration
351:"odd
126:functions
122:variables
91:debugging
39:(e.g., a
1444:See also
1366:my-value
1363:typecase
1351:my-value
1254:my-value
1239:my-value
1215:typecase
931:increase
847:increase
433:Examples
87:compiled
1099:myblock
1048:myblock
814:tagbody
782:tagbody
774:tagbody
731:console
707:console
689:console
288:default
266:default
205:fprintf
79:Fortran
59:address
1408:number
1390:string
1178:myloop
1133:myloop
444:syntax
408:"
396:printf
357:"
345:printf
306:"
294:printf
273:switch
223:"
211:stderr
193:return
187:number
160:number
145:number
75:Pascal
1432:print
1414:print
1396:print
1378:print
1329:print
1311:print
1284:print
1266:print
1211:ecase
1207:ccase
1190:print
1160:>=
1130:named
1111:print
1081:>=
1045:block
1031:named
1023:block
1010:print
998:progn
943:print
901:>=
889:check
883:check
853:print
823:print
817:start
725:break
672:break
634:alert
616:break
583:alert
414:break
363:break
312:break
236:error
234:Here
199:error
175:error
83:BASIC
41:colon
25:label
1438:))))
1372:list
1335:))))
1251:case
1221:and
1203:case
1142:from
1127:loop
1117:))))
1063:from
1054:loop
1027:loop
962:and
865:incf
835:setf
529:<
484:<
387:case
378:case
369:case
336:case
327:case
318:case
262:case
244:goto
240:goto
172:goto
163:<
133:void
124:and
115:goto
81:and
50:GOTO
23:, a
1345:let
1233:let
1196:)))
1136:for
1057:for
1013:#1#
1001:#1=
949:)))
937:end
919:end
805:NIL
796:let
768:In
737:log
728:top
713:log
695:log
680:top
619:top
571:===
559:===
511:var
505:for
466:var
460:for
451:top
279:die
181:bar
142:int
136:foo
101:In
93:).
70:MOV
67:or
64:JMP
19:In
1645::
1420:))
1402:))
1384:))
1357:))
1348:((
1317:))
1293:((
1290:))
1272:))
1245:))
1236:((
1217:,
1213:,
1209:,
1205:,
1166:10
1154:if
1148:do
1087:10
1075:if
1069:do
1016:))
934:))
928:go
916:go
907:10
895:if
880:go
808:))
799:((
786:go
661:);
610:);
550:if
541:++
496:++
411:);
405:\n
360:);
354:\n
309:);
303:\n
226:);
220:\n
190:);
154:if
1631:.
1610:.
1589:.
1568:.
1529:.
1508:.
1483:.
1429:(
1423:(
1411:(
1405:(
1393:(
1387:(
1375:(
1369:(
1360:(
1354:5
1342:(
1326:(
1320:(
1308:(
1305:)
1302:5
1299:4
1296:3
1281:(
1278:2
1275:(
1263:(
1260:1
1257:(
1248:(
1242:5
1230:(
1187:(
1184:)
1172:(
1169:)
1157:(
1151:(
1145:0
1124:(
1108:(
1105:)
1093:(
1090:)
1078:(
1072:(
1066:0
1051:(
1042:(
1007:(
995:(
988:n
984:#
982:n
980:#
976:=
974:n
972:#
968:#
966:n
964:#
960:=
958:n
956:#
940:(
925:(
922:)
913:(
910:)
898:(
892:(
886:)
877:(
874:)
871:1
862:(
859:)
850:(
844:)
841:0
832:(
829:)
820:(
811:(
793:(
778:C
749:}
746:)
740:(
734:.
722:)
716:(
710:.
704:)
698:(
692:.
686:{
683::
658:j
655:+
649:+
646:i
643:+
637:(
631:}
628:}
625:}
622:;
607:j
604:+
598:+
595:i
592:+
586:(
580:{
577:)
574:2
568:i
562:3
556:j
553:(
547:{
544:)
538:j
535:;
532:4
526:j
523:;
520:0
517:=
514:j
508:(
502:{
499:)
493:i
490:;
487:4
481:i
478:;
475:0
472:=
469:i
463:(
454::
420:}
417:;
399:(
393::
390:6
384::
381:4
375::
372:2
366:;
348:(
342::
339:5
333::
330:3
324::
321:1
315:;
297:(
291::
285:{
282:)
276:(
229:}
214:,
208:(
202::
196:;
184:(
178:;
169:)
166:0
157:(
151:{
148:)
139:(
103:C
97:C
Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.