Referencia › Grammar — 4 comandos


()

grammar

Entrada: (expressions…) (comparisons…)
Salida: none

Placed around complex expressions or comparisons to ensure proper order of processing.

if (9 + 3 / :container) > (2 * 97) [...]

[]

grammar

Entrada: [listitem1 listitem2 (listitem3…)]
Salida: list

Contains a list of items, for example requests, words or numbers. These are not
evaluated unless parsed for execution, for example in a repeat.

[forward 20 right 90]
[12 34 56 78]
[pig duck cow frog]

{}

grammar

Entrada: {listitem1 listitem2 (listitem3…)}
Salida: list

An evaluated list contains a list of words, lists and functions that are evaluated prior to processing. Useful for making a list from the results of functions, which can then be passed other functions. Note: when storing an evaluated list into a container, the list items are generated at the time the list is stored, and are static from that point onward, in contrast with runtime-evaluated expressions, which are dynamic and updated whenever the container is recalled.

make "myposition {xpos ypos zpos}
show :myposition
[0 80 0]

procedure

grammar

Entrada: "name
Salida: list

Returns a list of strings representing the lines of the named procedure. Each element in the list is one line from the procedure body (the lines between TO and END). This is useful for inspecting or manipulating procedure definitions programmatically.

to square :size
  repeat 4 [forward :size right 90]
end
show procedure "square
[repeat 4 [forward :size right 90]]