"while" Loop Statement

This section describes what is a 'while' loop statement in H language.

A "while" loop statement is a statement that executes a sub-statement repeatedly while the given condition is satisfied.

A "while" loop statement has the following syntax:

$while condition, sub-statement;

Examples of "while" loop statements are:

# the follow loop has no end
$while $true, sleep(60000); 

# the following loop ends when x reaches 100
sum = 0;
x = 0; 
$while x < 100, (
   x = x + 1;
   sum = sum + x;
);

Last update: 2017.

Table of Contents

 About This Book

 Introduction of H Language

 Syntax

 Data Types

 Variables

 Expressions

Statements

 What Is an Statement

 Expression Statement

 Assignment Statement

 Conditional "if" Statement

 Conditional "elseif" Statement

 Conditional "else" Statement

 Group Statement

"while" Loop Statement

 "for" Loop Statement

 Loop "break" Statement

 Loop "next" Statement

 "switch" Statement - Not Supported

 "do...while" Statement - Not Supported

 "boolean" Data Type

 "integer" Data Type

 "string" Data Type

 "real" Data Type

 "array" Data Type

 Source Code Packages

 Classes and Objects

 Object Oriented Programming

 Inheritance - Object Attachments

 Encapsulation - Private Members

 References

 PDF Printing Version