/* Source code made by iri This code is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. You can do what you want with it */ // We declare a global variable with an initial value, like "World" var myString = "World";; /* This function displays a message in the console. It takes one argument. Note that the type of an argument is never explicitely defined, a function can be polymorphic. The type will be implicitly determined by the compiler from the context. Arguments are available in the all body of the function (from the = symbol until the double semicolon). strcat is a Scol function : it concatenates two strings. The two arguments of strcat must have a type S, so the compiler considers string as a S. The return value by this function is the return value of its last instruction. _fooS returns a string (S), the function returns also a S. */ fun printHello (string)= _fooS strcat "Hello " string ;; /* print write few message in the console (and the log file). No argument is needed. In the first instruction, the previous written function is called, the global variable is passed to this one. Second, a new string is set to our global variable. Third, we have a new call to printHello. Don't forget, the myString value has changed ... Next, we define a local variable with "Alice" as initial value. Finally, we still call printHello with the local variable ... The return value of print is 0, an integer. This is common to return 0 when the value is no longer used. We should read in the console : Hello World Hello Bob Hello Alice */ fun print ()= printHello myString; set myString = "Bob"; printHello myString; let "Alice" -> anyString in printHello anyString; 0;; /* This is the main function. Its name can be anything. It can take 0 or any number of arguments. We can define several main functions if we want. The main function is a function called from the launcher script (*.scol). The first instruction shows the console. The second call the print function The third directly calls printHello with a customized argument. main returns 0, an integer. The return value does not affect the following the application. */ fun main ()= _showconsole; print; printHello "Scol Community !"; 0;;