Code: Select all
stdout.printf("test")
stdout.printf("test")
stdout.printf("ok\n")
stdout.flush()
stdout is printing to a buffer, so you finally in the end have to print a "\n", and you have to "flush" to be sure, it becomes visible.
The long line you mentioned also can be written like this:
Code: Select all
[indent=2]
init
//-- define the random characters --
myChars:array of string = {" ", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"}
//-- fill the line with a word --
var myLine = "testline"
print ("%s" , myLine)
//-- this is like the long line with print statements included
//-- calculate the allowed random numbers --
var thelength = myChars.length
//-- create a random number --
var randomvalue = Random.int_range(0,thelength)
//-- get a random character --
var randomcharacter = myChars[randomvalue]
print ("%s" , randomcharacter)
//-- add the character to the line --
var alltogether = myLine.concat(randomcharacter)
print ("%s" , alltogether)
I simplified the code.
Instead of:
Code: Select all
myLine:string = "testline"
Code: Select all
var myLine = "testline"
So instead of:
Code: Select all
var randomvalue = GLib.Random.int_range(0,thelength)
Code: Select all
var randomvalue = Random.int_range(0,thelength)