7.2.1 A first example

The first program is the same for all languages: say hello to the world! In CSI(C&F) the program to do this is

PRINT "Hello, World!"

PRINT CR

where "Hello, World" is the string that has to be printed and CR is a constant representing the carriage return escape sequence.

To run this program on your system you must create the program in a file that has not to have a special extension or format. The standard extension used by the developer is *.cst, but you can use your own filenames and extensions. If you run

csi hello_1.cst

it will print

Hello, World!

A CSI(C&F) program consists of procedures and variables, the latter being crisp or fuzzy data types. A procedure or function contains statements that specify the computing operations to be done, and variables store the values used during the computation.

In CSI(C&F) you have no main function like C++ has to have one. This does not mean that a CSI(C&F) program has no structural restrictions at all. The first part on the top of a CSI(C&F) program is always the main program, where other procedures, if given, can be invoked by a CALL statement. The part below the main program can be seen as procedure declaration space.

If you declare procedures, you have to mark the end of the main program with the EXIT statement. Beside marking the end of the main program the EXIT statement can be used to leave the program at any point, even in a procedure.

Now we will give a second version with the same behavior as the program above:

/* This is the main program */

CALL Hello

EXIT

/* This is the procedure declaration space */

PROCEDURE Hello

LET Say_Hello$ = "Hello, World!"

PRINT Say_Hello$

PRINT CR

RETURN

The two lines

/* This is the main program */

/* This is the procedure declaration space */

are comments, which can be used to explain briefly what the program does. Of course the keywords CALL, EXIT, etc. have not be stated in uppercase characters. CaLL, eXiT, etc. are also valid notations of this keywords. In this sense CSI(C&F) is not case sensitive. Not so on names of variables, procedures, etc. In CSI(C&F) the following procedure declarations and variable assignments are different:

PROCEDURE Hello

PROCEDURE heLLo

LET Say_Hello$ = "Hello, World!"

LET SAY_hello$ = "Hello,World!"

Procedures are a convenient way to encapsulate some computation, which can then be used without worrying about its implementation. With properly designed procedures, it is possible to ignore how a job is done; knowing what is done is sufficient.

When calling a procedure with CALL, the statement block within the invoked procedure is executed and after reaching the RETURN statement the execution continues with the next statement behind the CALL statement.

At this point we want to remark that procedures in the actual CSI(C&F) version can not return a value and consequently procedure calls can not be used in assignment statements. This may be changed in future versions of CSI(C&F).