| 1 | = Expression Tour = |
| 2 | |
| 3 | 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. |
| 4 | |
| 5 | == Displaying Expression Values == |
| 6 | |
| 7 | One of the best ways is to display an expression's value is to use the [wiki: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.): |
| 8 | |
| 9 | {{{ |
| 10 | #!python |
| 11 | trace p.x, p.y |
| 12 | }}} |
| 13 | {{{ |
| 14 | trace: p.x=5; p.y=6; at Foo.cobra:6; in Foo.main |
| 15 | }}} |
| 16 | |
| 17 | You can, of course, use a [wiki:Print] statement. On a related note, you can validate the value of an expression with an [wiki:Assert] statement. |