iprint, sprint - output of integers, characters, and strings
iprint(
n )
sprint( s )
iprint() writes the integer pointed to by n in decimal to the standard output window. Note that Tranquility only has support for integers and will truncate fractional numbers.
sprint() writes the string starting at the address s to the standard output window
iprint() and sprint() do not have return values
The tranqc(1) compiler will produce an "Argument list syntax error" if fractional values with a decimal point are used in iprint(3).
Hello world
from page 1 of the Tranquility Programmer’s Manual
https://www.cs.drexel.edu/~bls96/tranquility.pdf
fun init() { sprint("Hello World") }
The following
example from page 3 of the Tranquility Programmer’s
Manual
https://www.cs.drexel.edu/~bls96/tranquility.pdf
prints a table of squares from 0 to 9 to standard out.
fun sq( n ) { return .n * .n } fun init() { var i sprint("Table of squares:\n") i : 1 loop { until .i > 10 iprint( .i ) sprint(" squared equals ") iprint( sq(.i) ) nl() i : .i + 1 } }
Charlie Stuart
cstuart11@protonmail.com
Alex Jacobs, Fall 21-22
Cole Zucosky, Fall 21-22
Mahima Chacko, Fall 21-22
First, check
the Tranquility Programmer’s Manual
https://www.cs.drexel.edu/~bls96/tranquility.pdf
If the problem persists see Dr. Stuart or Charlie Stuart
Dr. Stuart:
brian.l.stuart@drexel.edu
Charlie Stuart:
cstuart11@protonmail.com
iread(3), sread(3), i2s(3)
Tranquility
Programmer’s Manual
https://www.cs.drexel.edu/~bls96/tranquility.pdf