Conditional "else" Statement

This section describes what is a conditional 'else' statement in H language.

A conditional "else" statement is a statement that follows an "if" or another "elseif" statement with a sub-statement.

A conditional "else" statement will be executed only when all conditions were failed in previous "if" and "elseif" statements.

When a conditional "else" statement executed, the given sub-statement is executed.

A conditional "else" statement has the following syntax:

$else, sub-statement;

Examples of conditional "else" statements are:

$if x > 0, write("x is a positive number.");
$elseif x < 0, write("x is a negative number.");
$else, write("x is zero.");

$if hour < 12, write("Good morning!");
$elseif hour > 18, write("Good evening!");
$else, write("Good afternoon.");

$if score >= 60, write("Pass!");
$else, write("Fail!");

Table of Contents

 About This Book

 Introduction of H Language


 Data Types




 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


 Full Version in PDF/ePUB