GOLF(2gg)
๐
GOLF(2gg) โ the new-array page, but make it cute โจ
okay bestie, welcome to GOLF(2gg), the Development corner of the manual, and today's main character is new-array. no cap, this is the glow-up your terminal needed. ๐
โจ NAME โจ
new-array โ (array) ๐ฆ
๐ฏ PURPOSE ๐ฏ
make a brand new array, bestie. that's it, that's the whole job. ๐
๐ SYNTAX ๐
new-array <array> [ max-size <max-size> ] [ process-scope ] [ type string | number | bool ]
look at her. iconic. ๐
๐ธ DESCRIPTION ๐ธ
new-array creates a new <array>. and like, what is an array here? it's an indexed array โ the index is a number, and each element is either a string, a number or a boolean. simple as that. ๐
so by default, like when you don't say anything about type, your <array> is an array of strings. but if you do use the type clause, you can say string, number or bool, and then <array> is an array of strings, numbers or booleans respectively. slay, choose your fighter. โจ
an array is flexible, meaning it just grows whenever it needs to. by default, an array allocates room for 256 elements, and it can grow up to 1,000,000 elements โ unless you hand it a <max-size> number in the max-size clause, in which case it can grow up to <max-size> elements. heads up though: <max-size> must be at least 256. no negotiating on that one. ๐
note that max-size only specifies the upper limit of allocation. the actual amount of memory allocated can vary. don't come for her about the details.
you do not need to pre-size the array, bestie. instead, when you write an element, it resizes automatically. for instance, you can set an array element arr[0] and then arr[1000] (with literally nothing in-between) and the array will automatically extend to accommodate. it's giving "i got you". ๐ซถ
but โ and this is important โ it will not automatically contract when trailing elements are deleted. it's not gonna shrink just because you left. ๐ญ use purge-array to delete all the elements in the array and shrink its memory footprint when your processing is done. periodt.
๐ฎ SCOPE ๐ฎ
an array is accessible to the current request only โ unless the process-scope clause is used, in which case all requests served by a process can use it (see do-once for a typical way to do this). ๐
if process-scope is used, then <array> will keep its data across all requests in a given process. see write-array for an example of a process-scoped array. ๐ง
๐ EXAMPLES ๐
create a new array:
new-array arr
boom. array created. main character energy achieved. ๐ฅ
๐ SEE ALSO ๐
- Array
new-arraypurge-arrayread-arraywrite-array- See all documentation โญ
okay that's the whole page bestie, you ate ๐
that was GOLF(2gg) โ source/version $VERSION, dated $DATE. go forth and make arrays. ๐๐ฆโจ
๐ฆ where this page comes from
- ubuntu questing: golf 601.4.41-1
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms