1,376
edits
| Line 482: | Line 482: | ||
debug.dump(pop(vector)); # prints "nil" | debug.dump(pop(vector)); # prints "nil" | ||
}} | }} | ||
=== range() === | |||
{{Nasal doc | |||
|syntax = range([start, ]stop[, step]); | |||
|source = {{simgear file|simgear/nasal/lib.c|l=757|t=Source}} | |||
|text = Creates a vector of numbers starting from <code>start</code> (default 0) up to but not including <code>stop</code>, incremented by <code>step</code> (default 1). Note: To specify <code>step</code>, you must also provide <code>start</code>; otherwise the second argument is interpreted as <code>stop</code>. | |||
|param1 = start | |||
|param1text = Optional. The starting number of the sequence. Defaults to 0 if omitted. | |||
|param2 = stop | |||
|param2text = Required. The number at which to stop the sequence (not included). | |||
|param3 = step | |||
|param3text = Optional. The increment between each number in the sequence. Defaults to 1. | |||
|example1 = | |||
var vec = range(5); # Creates a vector [0, 1, 2, 3, 4] | |||
var vec = range(2, 5); # Creates a vector [2, 3, 4] | |||
var vec = range(0, 10, 2); # Creates a vector [0, 2, 4, 6, 8] | |||
var vec = range(0, 0); # Creates an empty vector [] | |||
var vec = range(0, 1); # Creates a vector [0] | |||
}} | |||
=== remove() === | === remove() === | ||
edits