undar-lang/test/loop.ul

32 lines
528 B
Fortran

plex Terminal {
nat handle;
}
/**
* Main function
*/
function main() {
Terminal term = open("/dev/term/0", 0);
real a = 5.0;
do (int i = 5000, 0, -1) {
a = a + 5.0;
}
nat b = a as nat;
pln("Enter a string:");
str user_string = term.read(32);
pln(a as str);
pln(b as str);
pln(user_string);
}
/**
* Print with a newline
*/
function pln(str message) {
const str nl = "\n";
Terminal term = open("/dev/term/0", 0);
write(term, message, message.length);
write(term, nl, nl.length);
}