Wiki

Changes between Initial Version and Version 1 of ExpressionTour

Show
Ignore:
Timestamp:
06/20/10 03:58:39 (15 years ago)
Author:
Chuck
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ExpressionTour

    v1 v1  
     1= Expression Tour = 
     2 
     3This 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 
     7One 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 
     11trace p.x, p.y 
     12}}} 
     13{{{ 
     14    trace: p.x=5; p.y=6; at Foo.cobra:6; in Foo.main 
     15}}} 
     16 
     17You 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.