Assignment Statement

This section describes what is an assignment statement in H language.

An assignment statement is a statement that assigns data objects to variables or reference holders with the following syntax:

variable = object;
array[i] = object;
hash[name] = object;

Examples of assignment statements are:

s = "Hello"; # assigns a string object to a variable

a = array(); # assigns an array object to a variable
a[0] <- "Hello"; # assigns a string object to reference holder

h = hash(); # assigns a hash object to a variable
h["message"] <- "Hello"; # assigns a string object to reference holder

The equal sign "=" is actually an alias of the keyword $refers. So assignment statements actually have the follow syntax:

variable $refers object;
array[i] $refers object;
hash[name] $refers object;

Design options:

1. Use the equal sign "=" to identify an assignment statement:

x = 1;

2. Use "<-" to identify an assignment statement:

x <- 1;

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