Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /usr/share/doc/autogen/autogen.html/ drwxr-xr-x | |
| Viewing file: Select action/file-type: Next: Dynamic Text, Previous: Definitions, Up: Definitions File [Contents][Index] 2.3 Assigning an Index to a DefinitionIn AutoGen, every name is implicitly an array of values. When assigning values, they are usually implicitly assigned to the next highest slot. They can also be specified explicitly: mumble[9] = stumble; mumble[0] = grumble; If, subsequently, you assign a value to
#define FIRST 0 #define LAST 9 mumble[LAST] = stumble; mumble[FIRST] = grumble; All values in a range do not have to be filled in. If you leave gaps, then you will have a sparse array. This is fine (see FOR). You have your choice of iterating over all the defined values, or iterating over a range of slots. This: [+ FOR mumble +][+ ENDFOR +] iterates over all and only the defined entries, whereas this: [+ FOR mumble (for-by 1) +][+ ENDFOR +] will iterate over all 10 "slots". Your template will likely have to contain something like this: [+ IF (exist? (sprintf "mumble[%d]" (for-index))) +] or else "mumble" will have to be a compound value that, say, always contains a "grumble" value: [+ IF (exist? "grumble") +] |
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0066 ]-- |