Arrays can be simultaneously assigned and concatenated with the previously introduced += operator;
array_name
[ ] += {element_1
,element_2
, ...element_n
};array_name
[ ] +=expression
;
With the former syntax, elements element_1
to element_n
are appended to array_name
[ ]. Elements can be any valid expression.
With the latter syntax expression is evaluated and its result appended to array_name
[ ]. Please note that the evaluated expression
must be an array because of the braces after array_name
. Cows will raise an error if you try to assign a scalar
value to an array variable.
author = "-- Doris Day"; quote [ ] = { "Killing an animal to make a coat is sin.", "It wasn't meant to be,", "and we have no right to do it." }; quote [ ] += { "A woman gains status when she refuses to see", "anything killed to be put on her back.", "Then she's truly beautiful.", author };
An array is created an initialized with 3 elements. Then, 4 other elements - one of which is a variable - are appended. These are the elements and their values:
quote
[0]Killing an animal to make a coat is sin.
quote
[1]It wasn't meant to be,
quote
[2]and we have no right to do it.
quote
[3]A woman gains status when she refuses to see
quote
[4]anything killed to be put on her back.
quote
[5]Then she's truly beautiful.
quote
[6]- Doris Day
This manual can be downloaded from http://www.g-cows.org/.