Version 1 (modified by Chuck, 8 years ago)


Expression Tour

This is a "tour" of various kinds of expressions in Cobra. It is not a reference manual for expressions, but is instead intended to help you learn Cobra.

Displaying Expression Values

One of the best ways is to display an expression's value is to use the Trace statement which will show the source code of the expression, its value and the location of the trace in the source code (filename, line number, etc.):

trace p.x, p.y
    trace: p.x=5; p.y=6; at Foo.cobra:6; in Foo.main

You can, of course, use a Print statement. On a related note, you can validate the value of an expression with an Assert statement.