Constants and Simple Expressions

Both string constants and numeric expressions are primitives in SPLASH.

Take the SPLASH version of the classic "hello world" program as an example:

print('hello world\n');

This statement prints the line hello world on the console of the Sybase ESP Studio or on the terminal where the Sybase ESP Server was started. This sample code contains a string constant, surrounded by single quotes. This differs from C/C++ and Java, which use double quotes for string constants.

Numeric expressions are another primitive part of the language. Numeric constants are in integer form (1826), floating point decimal form (72.1726), or fixed-point decimal form. You can form expressions from the standard arithmetic operators (+, -, *, /, ^) and parentheses, with precedence defined as usual. The following expression will compute 57:
1 + 7 * 8
However, this expression will compute 64:
(1 + 7) * 8
SPLASH includes a host of arithmetic functions too. This function returns the sine of the value:
sine(1.7855)

Like C/C++ and Java, boolean expressions—that return true or false—are represented by numeric expressions. The integer 0 represents false, and any non-0 integer represents true. Comparison operators like = (equal), != (not equal), < (less than), and > (greater than) return 0 if false, and 1 if true. You can use the operators and, or, and not to combine boolean expressions. For instance, not(0 >1) returns 1.