Changes between Version 1 and Version 2 of NumericFor
- Timestamp:
- 07/12/08 21:09:38 (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
NumericFor
v1 v2 1 1 = Numeric For = 2 2 == Grammar == 3 {{{4 old-numeric-for-statement =5 for <variable> = <start> .. <stop> [ ++ | -- <step> ]6 <statements>7 }}}8 9 3 {{{ 10 4 numeric-for-statement = … … 12 6 <statements> 13 7 }}} 14 15 The old-numeric-for syntax is deprecated.16 8 17 9 If <start> is not specified it defaults to 0.[[BR]] … … 26 18 while <variable> < <stop> 27 19 ... statements.. 28 <variable> = <variable> +<step>20 <variable> += <step> 29 21 }}} 30 22 i.e The <stop> value is exclusive to the loop counter range. … … 37 29 print i # prints values 1,2,3,4,5,6,7,8,9 38 30 31 for i in 1 : 10 # can have spaces around : 32 print i 33 39 34 for i in 5 40 print i 35 print i # prints values 0,1,2,3,4 41 36 42 37 for i in 7:5:-1 43 print i 38 print i # prints values 7,6 44 39 45 40 for e in 20:31:2 … … 48 43 for f in 7:5 49 44 print f # never executed 45 46 for i in someList.count 47 print i # print the list indexes 50 48 }}} 51 49 50 == Old Syntax == 51 52 The old-numeric-for syntax is deprecated. 53 54 {{{ 55 old-numeric-for-statement = 56 for <variable> = <start> .. <stop> [ ++ | -- <step> ] 57 <statements> 58 }}}