5 ms·
While I understand your point, looking at that code, the first word into my mind isn't "trivial".
by dagenix 8y ago
While I understand your point, looking at that code, the first word into my mind isn't "trivial".
- therein 8y agoMakes me think of this: https://i.imgur.com/1LUysfW.png https://i.imgur.com/1LUysfW.png
- Spivak 8y agoIt actually is once you strip all the bash-isms. Here's what this code is really doing. def append(ARRAYNAME, VALUE): # Store the length of the array as a variable ARRAYNAME_LEN # Store the values of the array as variables ARRAYNAME_0, ARRAYNAME_1,... len = globals.get('{{ ARRAYNAME }}_LEN') || 0 len += 1 # Update the length. globals.set('{{ ARRAYNAME }}_LEN', len) # Add the value. globals.set('{{ ARRAYNAME }}_{{ len }}', VALUE) return Nobody said that bash has pretty syntax but this kind of thing wont even phase you once you're used to all the escaping and bracket substitution rules.