fn: console
[contents]

Contents

Syntax

The syntax for console calls is:

f++:  
console{options}(params)

n++:  
@console{options}(params)

Description

The console function is for outputting text to the console with a linebreak automatically added to the end, it takes an aribtrary number of parameters. You can use endl as a parameter for flushed line breaks, \n for unflushed.

Note: If you want multiple console calls to print to the console without being interrupted by output from threads building other files then use console.lock and console.unlock.

Note: Nift will skip to the first non-whitespace (ie. to the first character that is not a space, tab or newline) after a console call and inject it to the output file where the call started. If you want to prevent Nift from doing this put a '!' after the call, eg.:

@console("hello, world!")!

Options

The following options are available for console calls:

option description
b or block read and output block of text following console call
!pb do not parse block of text
option description

f++ example

Example of console being used with f++:

:=(int, i=12)
:=(string, str="hello")
console.lock
console("i: ", i)
console(str, ", world!")
console("first line", endl, "second line")
console{block}
{
	first line
	second line
	third line
}
console.unlock

n++ example

Example of console being used with n++:

@:=(int, i=12)
@:=(string, str="hello")
@console.lock
@console("i: ", i)
@console(str, ", world!")
@console("first line", endl, "second line")
@console{block}
{
	first line
	second line
	third line
}
@console.unlock

Sponsors