Skip to content

print

Declaration

print :: fn (format: string, args: ...) s32

Description

Write string to the standart output (stdout). Format string can include format specifiers % which are replaced by corresponding argument value passed in args. Value-string conversion is done automatically, we can pass values of any type as an arguments, even structures or arrays.

The print function accepts C-like escape sequences as \n, \t, \r, etc.

Arguments

  • format Formatting string.
  • args Additional values.

Result

Count of bytes printed out.

Example

main :: fn () s32 {
    print("Hello world!\n");
    print("My name is '%'.\n", "Travis");
    print("Number: %\n", 10);

    Foo :: struct {
        i: s32;
        j: s32;
    };

    foo := {:Foo: 10, 20};
    print("foo = '%'\n", foo);

    return 0;
}

Declared in: print.bl