Any

Placeholder datatype in definitions that represents any datatype (Integer, Real, Array, String, Boolean, File)

Integer

A whole number (e.g. 1, -2, 3).

Real

A decimal (e.g. 1.2, -3.4).

Number

Placeholder datatype in definitions that represents an Integer or a Real.

Boolean

Like an on/off switch, yes/no. Only holds the values true or false.

String

A string of characters, enclosed by quotes (e.g. "Hello world!").
Supports indexing like an array does, where string[n] returns the nth character of the string starting at zero.

Members

String.length: Integer
The length of the string (e.g. "banana".length == 6)
String.upper: String
The string converted to upper case (e.g. "mIxEd".upper == "MIXED")
String.lower: String
The string converted to lowercase (e.g. "mIxEd".lower == "mixed")
function String.left(chars: Integer) -> String
Returns the first chars characters of the string (e.g. "abcde".left(3) == "abc")
function String.right(chars: Integer) -> String
Returns the last chars characters of the string (e.g. "abcde".right(3) == "cde")
function String.substring(start: Integer, length: Integer) -> String
Returns length characters of the string, starting at start
function String.split(at: String) -> Arraywarning
Returns an array of strings, split by the string passed (e.g. "12, 34, 56".split(", ") gives the array [12, 34, 56]. at may be more than 1 character if necessary.
Note: This feature is not strictly part of the J277 specification. Using it will display a warning (which can be disabled in settings).
function String.compareAlphabetical(comparison: String) -> Integer
Compares the content of two strings by iterating through each character alphabetically. If the current string is alphabetically less than the one passed, then -1 is returned. If the two are equal, 0 is returned, and if the current string is alphabeticaly greater than the one passed then 1 is returned.

Array

A list of values, fixed in size. Can hold any datatype, but they must all be the same (e.g. [2, 3, 4], ["a", "c", "d"]).
Retrieve elements of an array using the syntax arr[element]. Arrays are zero-indexed, meaning the first element will be at arr[0]

Members

Array.length: Integer
The number of elements in the array
function Array.append(item: Any) -> Integerwarning
(deprecated) Append an item to the array, returning the new length. The type of the appended item must be the same type that the array currently contains. If the array is empty, there is no restriction on the appended item
Note: This feature is not strictly part of the J277 specification. Using it will display a warning (which can be disabled in settings).

File

A reference to a file. To open a file, use the open, openRead or openWrite functions.

Members

function File.writeLine(line: String) -> File
Writes the specified text to the file and appends a newline at the end, returning the file handle.
function File.readLine() -> String
Reads a line of text from the file object. Calling again will return the next line. Any attempt to read past the end of the file will return an empty string - to test for this, use the .endOfFile() method
function File.endOfFile() -> Boolean
Returns true if there is still unread content left in the file, else false.
function File.close() -> File
Closes the current file, returning the (now closed) file handle. No more read or write operations can be performed using this object now.