[FREE / Open Source] Dynamic Variables - Create Dynamic Variables

Extension for adding dynamic variables in AI2 and its distributions.

Documentation

BlocksDescription
Raises when any error occured.

ParamsType
errorString
Initialize a variable.

ParamsType
nameAny
valueAny
Initialize list of variables. Both list mustn't be empty. "names" and "values" must a list, and their length must be the same.

ParamsType
namesList
valuesList
Returns: Any
Get the value of a variable. If the variable doesn't exist, return null.

ParamsType
nameAny
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.

ParamsType
namesList
Returns: List
Get variables' names by its value. Return an empty list if there are no variables, or when error occured.

ParamsType
valueAny
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.

ParamsType
oldNameAny
newNameAny
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.

ParamsType
oldNamesList
newNamesList
Returns: Any
Remove a variable and return removed value. If the variable doesn't exist, return null.

ParamsType
nameAny
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.

ParamsType
namesList
Remove all variables.
Returns: Boolean
Check if given variable name exists. Return true if variable exists, otherwise false. Return false if an error occurred.

ParamsType
nameAny
Returns: Boolean
Check if given value exists. Return true if value exists, otherwise false. Return false if an error occurred.

ParamsType
valueAny
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