-
-
Notifications
You must be signed in to change notification settings - Fork 23
OSL ‐ Variables
-
variablename = "assign-data":
-
Description: Sets a variable with the specified name (
variablename) to the inputted data ("assign-data"). -
Example:
count = 10
This sets the variable
countto the value10. -
Example (Setting a variable to an array):
array = ["hello", "world"]
or
array = [ "hello", "world" ]
This sets the variable
arrayto the value["hello", "world"]. -
Example (Setting a variable to an object):
array = {"hello":"world"}
or
array = { "hello":"world" }
This sets the variable
arrayto the value["hello", "world"].
-
-
list.[itemnumber] = "assign-data":
-
Description: Sets the selected item of a list (specified by
[itemnumber]) to the inputted data ("assign-data"). -
Example:
This sets the third item in the list
mylist.[2] = "new_value"
mylistto the value"new_value".
-
Description: Sets the selected item of a list (specified by
-
object.key("key") = "assign-data":
-
Description: Sets the selected key of a JSON object (specified by
"key") to the inputted data ("assign-data"). -
Example:
This sets the value associated with the key
myobject.key("name") = "John"
"name"in the JSON objectmyobjectto"John".
-
Description: Sets the selected key of a JSON object (specified by
-
object."key" = "assign-data":
-
Description: Sets the selected key of a JSON object (specified by
"key") to the inputted data ("assign-data"). -
Example:
This sets the value associated with the key
myobject."name" = "John"
"name"in the JSON objectmyobjectto"John".
-
Description: Sets the selected key of a JSON object (specified by
-
object.["key"] = "assign-data":
-
Description: Sets the selected key of a JSON object (specified by
"key") to the inputted data ("assign-data"). -
Example:
This sets the value associated with the key
myobject.["name"] = "John"
"name"in the JSON objectmyobjectto"John".
-
Description: Sets the selected key of a JSON object (specified by
-
variable += 10:
- Description: Appends ten to the end of a string or adds ten to a number data type.
-
Example:
This increments the value of the variable
count += 5
countby 5.
-
variable *= 5:
- Description: Sets the variable to itself multiplied by 5. This operation works only on number data types.
-
Example:
This doubles the value of the variable
total *= 2
total.
-
variable /= 5:
- Description: Sets the variable to itself divided by 5. This operation works only on number data types.
-
Example:
This halves the value of the variable
price /= 2
price.
-
variable -= 5:
- Description: Sets the variable to itself minus 5. This operation works only on number data types.
-
Example:
This subtracts 10 from the value of the variable
balance -= 10
balance.
-
variable %= 5:
- Description: Sets the variable to itself mod 5. This operation works only on number data types.
-
Example:
This does a modulus calculation on the value of
balance %= 10
balance.
These commands and modifiers enable you to manipulate variables, lists, and JSON objects, performing assignments and arithmetic operations as needed in your script.
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