HPlogo HP C/HP-UX Reference Manual: Workstations and Servers > Chapter 6 Statements

Labeled Statements

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Index

Labeled statements are those preceded by a label.

Syntax

labeled-statement ::=
identifier : statement
case constant-expression : statement
default: statement

Description

You can prefix any statement using a label so at some point you can reference it using goto statements. This includes statements already having labels. In other words, any statement can have one or more labels affixed to it.

The case and default labels can only be used inside a switch statement. These are discussed in further detail in the section on the switch statement appearing later in this chapter.

Examples

if (fatal_error)
goto get_out;
.
.
.
get_out: return(FATAL_CONDITION);