fn: write
[contents]

Contents

Syntax

The syntax for write calls is:

f++:  
write{option}(ostream, params)

n++:  
@write{option}(ostream, params)

Description

The write function is for writing/printing output, it takes at least two parameters, the first parameter should be an output stream (either console, ofile, a file stream or a string stream), the remainder of the parameters should be either endl for a new line, a variable to print or a number/string to print.

Options

The following options are available for write calls:

option description
b or block call follows with a block of text to write/print
!pb do not parse block of text with b/block option
f++ parse block with f++
n++ parse block with n++
option description

f++ example

Examples of write being used with f++:

  1. write(console, "hello, world!", endl)

  1. write{b}(console)
  2. {
  3. First line
  4. Second line
  5. Indented Line
  6. Last line
  7. }

  1. :=(string, s = "hello, world!")
  2. :=(ofstream, ofs("output.txt"))
  3. write(ofs, s, endl)
  4. ofs.close()

n++ example

Examples of read being used with n++:

  1. @write(console, "hello, world!", endl)

  1. @write{b}(console)
  2. {
  3. First line
  4. Second line
  5. Indented Line
  6. Last line
  7. }

  1. @:=(string, s = "hello, world!")
  2. @:=(ofstream, ofs("output.txt"))
  3. @write(ofs, s, endl)
  4. @ofs.close()