Introduction to Water Programming

This Site is intended to provide helps to Water 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 Steam Free Version or the IDE. (If you are using the Free Version, be sure to set the output to "Rendered HTML".)

Example 2. Adding Two Numbers

Performing arithmetic operations is fundamental to most programming languages. Let's examine a few examples using Basic, Lisp and Water.

Basic:
PRINT 2 + 3
Lisp:
(+ 2 3)
Water:
2.<plus 3 /> or <plus 2 3 />

If I want to print something like "2 + 3 = 5", it would look like this.

Basic:
PRINT "2 + 3 ="; 2 + 3
Lisp:
(format t "2 + 3 = ~d" (+ 2 3))
Water:
<concat "2 + 3 = " <plus 2 3 /> />

As you can see, doing simple calulations is relatively the same, but producing output is a bit different in each language. You will find this is true for most new languages you will learn.

By the way, here are the basic arithmetic operations in Basic, Lisp and Water.

Basic:
Addition: 2 + 3, Subtraction: 3 - 2, Multiplication: 3 * 2, Division: 3 / 2
Lisp:
Addition: (+ 3 2), Subtraction: (- 3 2), Multiplication: (* 3 2), Division: (/ 3 2)
Water:
Addition: <plus 2 3 />, Subtraction: <minus 3 2 />, Multiplication: <times 3 2 />, Division: <divide 3 2 />

Go back to go to the next example.

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