User Tools

Site Tools


harlowe:a

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

harlowe:a [2017/10/09 20:39] (current)
Line 1: Line 1:
 +**(a: // <span class=parameter_optional>​[</​span>​...Any<​span class=parameter_optional>​]</​span>//​) -> //​[[harlowe:​Array|array]]//​**
  
 +Also known as: [[harlowe:​array|(array:​)]]
 +
 +Creates an [[harlowe:​array|array]],​ which is an ordered collection of values.
 +
 +=== Example usage: ===
 +
 +''​%%(a:​)%%''​ creates an empty array, which could be filled with other values later.
 +''​%%(a:​ "​gold",​ "​frankincense",​ "​myrrh"​)%%''​ creates an array with three [[harlowe:​string|string]].
 +This is also a valid array, but with its elements spaced in a way that makes them more readable:
 +
 +<​code>​
 +(a:
 +"You didn't sleep in the tiniest bed",
 +"You never ate the just-right porridge",​
 +"You never sat in the smallest chair",​
 +)
 +</​code>​
 +=== Rationale: ===
 +
 +For an explanation of what arrays are, see the Array article. This macro is the primary
 +means of creating arrays - simply supply the values to it, in order.
 +
 +=== Details: ===
 +
 +Note that due to the way the spread ''​%%...%%''​ operator works, spreading an array into
 +the (a:) macro will accomplish nothing: ''​%%(a:​ ...$array)%%''​ is the same as just the ''​%%$array%%''​.
 +
 +=== See also: ===
 +
 +[[harlowe:​dm|(dm:​)]],​ [[harlowe:​ds|(ds:​)]]
harlowe/a.txt ยท Last modified: 2017/10/09 20:39 (external edit)