-
-
Notifications
You must be signed in to change notification settings - Fork 19
OSL ‐ Arrays
Mistium edited this page Nov 7, 2023
·
10 revisions
Arrays in OSL are defined by [] and can have any length and any data type in any item
So you can have arrays of arrays with json objects and integers if you really want
Example array:
["Hello","Wow",100,{"huh":10}]
type the name of the array and then = and then the array data
array = ["test","data"]
-
.append("string")
- Adds a new element (in this case, a string) to the end of an array.
- Example:
["hi"].append("goodbye")
results in["hi", "goodbye"]
.
-
.index("string")
- Finds the index of a specific element (string) in an array.
- Example:
["hi", "goodbye"].index("hi")
returns1
, with array indices starting from 1.
-
.delete(int)
- Removes an element at a specific index from an array.
- Example:
["hi", "goodbye"].delete(1)
returns["goodbye"]
.
-
.item(int)
or.[int]
- Retrieves the item at a specific index in the array.
- Example:
["hi", "goodbye"].item(1)
or["hi", "goodbye"].[1]
returns"hi"
.
-
.join("string")
- Combines all elements of an array into a single string, separated by the specified separator.
- Example:
["hello", "how are you"].join(", ")
returns"hello, how are you"
.
-
.split("string")
- Splits a string into an array of substrings, separated by the specified separator.
- Example:
"hello, how are you".split(" ")
returns["hello,", "how", "are", "you"]
.
originOS is a web desktop gui with a self contained file system, programming languages, internet system and a whole lot of stuff an os should be able to do Use originOS here