Extension for adding dynamic variables in AI2 and its distributions.
Documentation
Blocks | Description |
---|
 | Raises when any error occured.
|
 | Initialize a variable.
Params | Type |
---|
name | Any | value | Any |
|
 | Initialize list of variables. Both list mustn't be empty. "names" and "values" must a list, and their length must be the same.
Params | Type |
---|
names | List | values | List |
|
 | Returns: Any Get the value of a variable. If the variable doesn't exist, return null.
|
 | Returns: List Get a list of values. The input should be a list of variable's names. If any of the variables doesn't exist, that item will be null. If the input list is empty, or any errors occurred, return an empty list.
|
 | Returns: List Get variables' names by its value. Return an empty list if there are no variables, or when error occured.
|
 | Returns: List Get all of the variable names. Return an empty list if there are no variables, or when error occured. |
 | Returns: List Get all of the values. Return an empty list if there are no variables, or when error occurred. |
 | Rename a variable. If the old variable doesn't exist, error will occur.
Params | Type |
---|
oldName | Any | newName | Any |
|
 | Rename a list of varibles. All list must not be empty. Length of both list must be the same. If any one of the old names doesn't exist, error will occur.
Params | Type |
---|
oldNames | List | newNames | List |
|
 | Returns: Any Remove a variable and return removed value. If the variable doesn't exist, return null.
|
 | Returns: List Remove list of variables and return a list of removed values. If any of variable's name doesn't exist, that item of the list will be null.
|
 | Remove all variables. |
 | Returns: Boolean Check if given variable name exists. Return true if variable exists, otherwise false. Return false if an error occurred.
|
 | Returns: Boolean Check if given value exists. Return true if value exists, otherwise false. Return false if an error occurred.
|
 | Returns: Number (int) Return the number of variables. Return -1 if an error occurred. |
 | Returns: Boolean Check if any variables exist. Return true if no variable exists, otherwise false. Return false if an error occurred. |
Download
v1.1
Changelog
v1.1
- Removed method code and error code; they are useless
- Changed
NumOfVariables
to Size
- Changed
IsVariableExist
to NameExist
- Added
ValueExist
- Added
GetNameByValue
- Some methods return
"null"
instead of "not found"
Reference
Kodular Community
MIT AI2 Community
Comments