Print Statements

Learn about the different print statements here.

  • println(): The println() command is the most basic and arguably the most used statement in JVM languages like Java, Kotlin and Cylvre. For languages like Kotlin and Cylvre, println() compiles down to the bytecode equivalent ofSystem.out.println() in Java. It is a function that prints the desired output and adds a new line character \n at the end.

Example

func main(){
    println("Hello"); println("World");
}
  • print(): The print() command is more or less the same as println(), but without the new line character insertion. In JVM languages like Kotlin and Cylvre, it compiles down to the bytecode equivalent of System.out.print() in Java. While the above example prints "Hello" and "World" on two separate lines, the below example will print them on the same line together, unless a space is explicitly declared.

Example

func main(){
    print("Hello");
    print("World");
}
  • print_err(): We now come to error printing or stderr. This function, unique to Cylvre, compiles down to the bytecode equivalent of System.err.println() in Java. It prints an error and is sometimes highlighted red in some IDEs.

Example

func main(){
    x : 12;
    x = 10 ? println("is ten");
    x != 10 ? print_err("not ten");
}

Not to worry about the conditional syntax of Cylvre, it will be explained later.

Last updated