watch (string text, ...)

Prints the given text and up to 8 following bool, int, var, float, or string variables to the message window or the log, or add text to exception or crash messages (lite-C only). Can enter single step debugging mode. Allows to quickly debug into functions and watch variable behavior.

Parameters:

text

Text string to be displayed, followed by the variables. If the string begins with an exclamation mark "!...", script execution stops at that line and Zorro changes to debugging mode. This way the behavior of variables inside a loop or function can be debugged step by step. If the string begins with a "#" character, the text is not displayed in the message window, but printed in all modes to the log or - in diagnostics mode - to the diag.txt file (see Verbose). If the string begins with a "?", the text is displayed together with the next exception or crash message. If the string contains a decimal point '.', float, double, or var variables are printed in higher precision.

... Up to 8 variables, function calls, or expressions to be watched. Supported are bool, int, var, double, float, or string. Floating point types are displayed with 5 decimals.

Remarks:

Examples:

int i;
for(i=0; i<10; i++)
  watch("!i",i,"twice",2*i,"square",i*i);

See also:

Verbose, debugging, printf, troubleshooting

► latest version online