Debugging functions

Functions for debugging expressions.


Console

Console([value1, ..., valueN]?) -> Null

Function bundle: Core

Logs a message in the messages window for debugging purposes. This function can be especially useful for inspecting variable values within a custom function at runtime. Unlike other functions and the return statement, Console() doesn't actually return a value; rather, it logs messages in a separate window for inspection purposes only. The successful use of this function has no computational impact on the evaluation of the expression.

Parameter

  • [value1, ..., valueN] (Optional): Any - A list of variables, text, number, or dictionary to output in the messages window.

Return value: Null

Example

Prints the value of max for each iteration of the loop within the function

Use dark colors for code blocksCopy
                 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// The messages window will log the following:
// 'current item is: 10, but max = 10'
// 'current item is: 0, but max = 10'
// 'current item is: 84, but max = 84'
// 'current item is: 30, but max = 84'

// The expression evaluates to 84
function findMax(yourArray) {
  var max = -Infinity;
  for (var i in yourArray) {
    max = IIf(yourArray[i] > max, yourArray[i], max);
    Console('current item is: ' + i + ', but max = ' + max);
  }
  return max;
}
var myArray = [ 10, 0, 84, 30];
findMax(myArray);

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.