Skip to reading
PCA Script Programming

Builtins: Ranges

Edition 0.86.4.1 HF1

0.86.4.1 Hotfix 1 edition. Earlier lessons and screenshots retain their original version context; revised references and supplements describe the newer behavior.

Download PDFView PDF page
On this page

file_exists()#

Code example
file_exists(path)

Check whether a file exists at an accessible path.

Returns: Boolean.

Code example
file_exists("user://preferences.json")

directory_exists()#

Code example
directory_exists(path)

Check whether a directory exists.

Returns: Boolean.

Code example
directory_exists("user://tutorial")

range()#

Code example
range(stop) or range(start, stop, step = 1)

Build integers starting at start (default 0) and ending before stop.

Returns: Array of integers.

Code example
range(1, 6)

Negative steps count down. Step 0 fails. The builder has a 100,000-item safety limit.

range_inclusive()#

Code example
range_inclusive(start, finish, step = 1)

Build a range that can include the finish value when reached by the step.

Returns: Array of integers.

Code example
range_inclusive(1, 5)

An incompatible direction gives no values. A step that skips the endpoint does not invent an extra final value.

Page 75 of 357Permalink
Go to page