Block Statement Uses {...}; Format

This section describes how to enter block statements in H source code.

A block statement must be enclosed between "{" and "}".

This helps us to tie multiple statements together as a single statement to be used as a component to another statement. Within a block statement, variable visibility is changed. For example,

rate = 1.03; #commission rate

$function exchange(eur): {
   rate = 1.19; # exchange rate
   usd = rate*eur;
   $return usd;
};

eur = 10.00;
usd = exchange(eur);
usd = rate*usd;

write(usd);

Design options:

1. A block statement is enclosed in { and }.

2. A group statement is enclosed in BEGIN and END.

3. A group statement is identified with extra indentation.

Last update: 2017.

Table of Contents

 About This Book

 Introduction of H Language

Syntax

 Source Code Encoding Format - UTF-8

 Statements End with Semicolons

 Inline Comments Start with #

 Block Comments Enclosed in #(...)#

 Group Statement Uses (...); Format

Block Statement Uses {...}; Format

 Data Types

 Variables

 Expressions

 Statements

 "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