Changes between Version 9 and Version 10 of ExpressionTour
- Timestamp:
- 05/28/13 13:28:44 (11 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ExpressionTour
v9 v10 8 8 9 9 {{{ 10 #! python10 #!cobra 11 11 trace p.x, p.y 12 12 }}} … … 26 26 Arithmetic 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. 27 27 {{{ 28 #! python28 #!cobra 29 29 assert 4 / 5 = 0.8 30 30 assert 4 // 5 == 0 … … 35 35 Augmented assignment operators can be used to change values: 36 36 {{{ 37 #! python37 #!cobra 38 38 i += 1 39 39 p.x *= 2 … … 60 60 Boolean expressions include the literals `true` and `false` as well as logical operations such as `and`, `or`, `not`, comparisons and other tests. 61 61 {{{ 62 #! python62 #!cobra 63 63 obj.isActive = true 64 64 if obj.isActive, .doSomething 65 65 }}} 66 66 67 Note: You dont need to compare booleans against true or false ( dont say == true or ==false). Most things have a natural truth or not68 see 67 Note: You dont need to compare booleans against true or false ( dont say == true or ==false).[[BR]] 68 Most expressions can determine a natural truth or not. See ConditionalExpr. 69 69 70 70