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++:

  1. :=(int, i=12)
  2. :=(string, str="hello")
  3. console.lock
  4. console("i: ", i)
  5. console(str, ", world!")
  6. console("first line", endl, "second line")
  7. console{block}
  8. {
  9. first line
  10. second line
  11. third line
  12. }
  13. console.unlock

n++ example

Example of console being used with n++:

  1. @:=(int, i=12)
  2. @:=(string, str="hello")
  3. @console.lock
  4. @console("i: ", i)
  5. @console(str, ", world!")
  6. @console("first line", endl, "second line")
  7. @console{block}
  8. {
  9. first line
  10. second line
  11. third line
  12. }
  13. @console.unlock