Conditional "elseif" Statement

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

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

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

When a conditional "elseif" statement executed, the given condition is evaluated first, if the condition is satisfied, the given sub-statement is then executed.

A conditional "elseif" statement has the following syntax:

$if ...;
$elseif ...;
$elseif condition, sub-statement; 

Examples of conditional "elseif" statements are:

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

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

Design options:

1. Use $elseif to specify "elseif" statements.

2. Use $elsif to specify "elseif" statements.

3. Use $else $if to specify "elseif" statements.

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