All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ceylon.language.print.ceylon Maven / Gradle / Ivy

There is a newer version: 1.3.3
Show newest version
"Print a line to the standard output of the virtual machine 
 process, printing the given value\'s `string`, or `` 
 if the value is `null`.
 
 This function is a shortcut for:
 
     process.writeLine(line?.string else \"\")
 
 and is intended mainly for debugging purposes."
see (`function process.writeLine`)
by ("Gavin")
tagged("Environment")
shared void print(Anything val) 
        => process.writeLine(stringify(val));

"Print multiple values to the standard output of the virtual 
 machine process as a single line of text, separated by a
 given character sequence."
by ("Gavin")
see (`function process.write`)
tagged("Environment")
shared void printAll({Anything*} values,
        "A character sequence to use to separate the values"
        String separator=", ") {
    variable value first = true;
    values.each((element) {
        if (first) {
            first = false;
        }
        else {
            process.write(separator);
        }
        process.write(stringify(element));
    });
    process.write(operatingSystem.newline);
}

String stringify(Anything val) => val?.string else "";




© 2015 - 2024 Weber Informatics LLC | Privacy Policy