SQUARE.sml

  Download

More scripts: SML Fundamentals

Syntax Highlighing:

comments, key words, predefined symbols, class members & methods, functions & classes
            
# square.sml
# Example of user-defined procedure that modifies the value
# of a variable passed to it (variable by reference) using the var keyword.
# procedure prototype
proc square(numeric a, var numeric b);
numeric v1 = 5;
numeric v2 = 0;
clear();
proc square(numeric a, var numeric b)
	{
	b = a * a;
	}
square(v1, v2);
printf("The square of %d is %.1f\n", v1, v2);