watch (string text, ...)

Displays the given text and up to 8 following bool, int, var, float, or string variables in the message window, or prints them to the log or diag.txt file in all modes. Optionally stops execution and changes to single step 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).

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

Example:

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

See also:

Debugging, Verbose, Debugger, printf, troubleshooting

► latest version online