Wiki

Changes between Version 9 and Version 10 of ExpressionTour

Show
Ignore:
Timestamp:
05/28/13 13:28:44 (11 years ago)
Author:
hopscc
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ExpressionTour

    v9 v10  
    88 
    99{{{ 
    10 #!python 
     10#!cobra 
    1111trace p.x, p.y 
    1212}}} 
     
    2626Arithmetic has the usual infix operators and parentheses for grouping. Note that division with a single slash (/) gives a fractional value. Use a double slash (//) for "integer" division. 
    2727{{{ 
    28 #!python 
     28#!cobra 
    2929assert 4 / 5 = 0.8 
    3030assert 4 // 5 == 0 
     
    3535Augmented assignment operators can be used to change values: 
    3636{{{ 
    37 #!python 
     37#!cobra 
    3838i += 1 
    3939p.x *= 2 
     
    6060Boolean expressions include the literals `true` and `false` as well as logical operations such as `and`, `or`, `not`, comparisons and other tests. 
    6161{{{ 
    62 #!python 
     62#!cobra 
    6363obj.isActive = true 
    6464if obj.isActive, .doSomething 
    6565}}} 
    6666 
    67 Note: You dont need to compare booleans against true or false ( dont say == true or ==false). Most things have a natural truth or not 
    68 see 
     67Note: You dont need to compare booleans against true or false ( dont say == true or ==false).[[BR]]  
     68Most expressions can determine a natural truth or not. See ConditionalExpr. 
    6969 
    7070