Introduction to Var'aq Programming

This Site is intended to provide helps to Var'aq language programmers around the world through technical examples, informational articles, and personal assistance.

The following examples are meant to be a quick Getting Started sort of tutorial using the varaq-kling.pl version in Perl.

Example 6. If-Then-Else
One of the most powerful abilities of the computer is the ability to perform large numbers of comparisons in a short period of time. Var'aq provide relational operators and conditional flow-control statements so that programs can choose a course of action based on current program conditions.

In most languages in English, this is accomplished using the IF-THEN-ELSE construct. In Var'aq, we use the 'ifyes' and 'ifno' operations ("HIja'chugh" and "ghobe'chugh" respectively).

Var'aq:
(* Assume that a user's age is entered as a precondition to this function call. *)

"check_age"
{ 
   18 puS'a' wIv  (* if user_age is less than 18 *)

   { woD "The respondent is not of age." cha' 1 } HIja'chugh

   { "The respondent is of age."  cha'  } ghobe'chugh

} pong


10 check_age    (* prints "The respondent is not of age." *)

20 check_age    (* prints "The respondent is of age."     *)

The appearance of woD and 1 in the HIja'chugh line is an important matter to address. The Perl implementation of Var'aq at the time of this writing simply uses a '1' to represent boolean 'true' and '0' to represent boolean 'false'. This is fine. However, since the Var'aq 'wIv' instruction simply duplicates the boolean value without any other marks to identify it to the processes, the duplicated value gets in the way of the initial conditional procedure. To work around this, I have gotten into the habit of using this '( woD ... 1 }' combination with 'HIja'chugh', and the '( woD ... 0 }' combination with 'ghobe'chugh'. Notice that this is only necessary on the first conditional procedure in the sequence. Like this:

conditional expression wIv
{ woD procedural statments 1 } HIja'chugh
{ procedural statements } ghobe'chugh

OR

conditional expression wIv
{ woD procedural statments 0 } ghobe'chugh
{ procedural statements } HIja'chugh

Go back to go to the next example.

©Copyright 2004, Mr. Merrick J. Stemen. All rights reserved.