Control statements, such as
while, and so on,
control the flow of execution in
awk programs. Most of
control statements are patterned after similar statements in C.
All the control statements start with special keywords, such as
while, to distinguish them from simple expressions.
Many control statements contain other statements. For example, the
if statement contains another statement that may or may not be
executed. The contained statement is called the body.
To include more than one statement in the body, group them into a
single compound statement with braces, separating them with
newlines or semicolons.
|• If Statement:||Conditionally execute some |
|• While Statement:||Loop until some condition is satisfied.|
|• Do Statement:||Do specified action while looping until some condition is satisfied.|
|• For Statement:||Another looping statement, that provides initialization and increment clauses.|
|• Switch Statement:||Switch/case evaluation for conditional execution of statements based on a value.|
|• Break Statement:||Immediately exit the innermost enclosing loop.|
|• Continue Statement:||Skip to the end of the innermost enclosing loop.|
|• Next Statement:||Stop processing the current input record.|
|• Nextfile Statement:||Stop processing the current file.|
|• Exit Statement:||Stop execution of |