bitburner-src/markdown/bitburner.ns.printf.md
omuretsu 06a985bdf8 Revert "Remove markdown from git tracking (#139)"
This reverts commit bbb6e3f309935aebac74ddb1fbeec12dfb7540b1.
2022-10-21 11:16:00 -04:00

1.4 KiB
Raw Blame History

Home > bitburner > NS > printf

NS.printf() method

Prints a formatted string to the scripts logs.

Signature:

printf(format: string, ...args: any[]): void;

Parameters

Parameter Type Description
format string Format of the message.
args any[] Value(s) to be printed.

Returns:

void

Remarks

RAM cost: 0 GB

Example 1

// NS1
var name = "Bit";
var age = 4;
printf("My name is %s.", name);
printf("I'm %d seconds old.", age);
printf("My age in binary is %b.", age);
printf("My age in scientific notation is %e.", age);
printf("In %d seconds, I'll be %s.", 6, "Byte");
printf("Am I a nibble? %t", (4 == age));
tail();

Example 2

// NS2
const name = "Bit";
const age = 4;
ns.printf("My name is %s.", name);
ns.printf("I'm %d seconds old.", age);
ns.printf("My age in binary is %b.", age);
ns.printf("My age in scientific notation is %e.", age);
ns.printf("In %d seconds, I'll be %s.", 6, "Byte");
ns.printf("Am I a nibble? %t", (4 == age));
ns.tail();