05-13-2022, 11:34 AM | #16 | ||
Grand Sorcerer
Posts: 11,742
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
The grammar for for loops: Code:
for_expr ::= for_list | for_range for_list ::= 'for' identifier 'in' list_expr [ 'separator' separator_expr ] ':' expression_list 'rof' for_range ::= 'for' identifier 'in' range_expr ':' expression_list 'rof' range_expr ::= 'range' '(' [ start_expr ',' ] stop_expr [ ',' step_expr [ ',' limit_expr ] ] ')' list_expr ::= top_expression separator_expr ::= top_expression start_expr ::= top_expression stop_expr ::= top_expression step_expr ::= top_expression limit_expr ::= top_expression Code:
current_value + step >= stop The example in post 10 is now expressed as Code:
program: res = ''; for i in range(strlen($title)): c = substr($title, i, i+1); res = strcat(res, if mod(i, 2) == 0 then uppercase(c) else c fi) rof Code:
program: res = ''; for i in range(0, strlen($title), 1, 100): c = substr($title, i, i+1); res = strcat(res, if mod(i, 2) == 0 then uppercase(c) else c fi) rof Quote:
Last edited by chaley; 05-13-2022 at 11:38 AM. |
||
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Template: Converting a search & replace into a template | ownedbycats | Library Management | 11 | 03-26-2021 04:32 AM |
Request for comments: new template language operations | chaley | Library Management | 3 | 02-27-2021 12:09 PM |
Request: Match Calibre Filename template recipe | cbook7 | Library Management | 10 | 06-05-2020 05:11 AM |
Request: template-making assistance for column built from other columns | iienderii | Library Management | 9 | 04-04-2016 10:27 PM |
Request for Feedback on E-book Web Template | andreasw | Writers' Corner | 5 | 05-14-2011 12:34 AM |