doc: added description of set() and unset() functions defined in the base buiiltin
This commit is contained in:
parent
02df7f1c1f
commit
d7247f97c5
@ -1087,6 +1087,8 @@ The "base" builtin module provides functions for type checking and type conversi
|
||||
|
||||
.Other functions
|
||||
* <<_eval,eval()>>
|
||||
* <<_set,set()>>
|
||||
* <<_unset,unset()>>
|
||||
* <<_var,var()>>
|
||||
|
||||
|
||||
@ -1318,6 +1320,32 @@ This function allows you to define variables whose names must include special ch
|
||||
`>>>` [blue]`var("gain%", var("$x")+1)` +
|
||||
[green]`13`
|
||||
|
||||
===== set
|
||||
Syntax: +
|
||||
`{4sp}set(<string-expr>, <expr>) -> any`
|
||||
|
||||
This function allows you to set the value of a variable whose name can include special characters. The first parameter is the name of the variable and the second parameter is the new value to assign to that variable.
|
||||
|
||||
It is equivalent to the first form of the var() function, but it is more explicit about the intent of changing the value of an existing variable.
|
||||
|
||||
.Examples
|
||||
`>>>` [blue]`set("$x", 100)` +
|
||||
[green]`100` +
|
||||
`>>>` [blue]`var("$x")` +
|
||||
[green]`100` +
|
||||
|
||||
===== unset()
|
||||
Syntax: +
|
||||
`{4sp}unset(<string-expr>) -> any`
|
||||
|
||||
This function allows you to unset a variable whose name can include special characters. The parameter is the name of the variable to unset.
|
||||
|
||||
.Examples
|
||||
`>>>` [blue]`unset("$x")` +
|
||||
[green]`nil` +
|
||||
`>>>` [blue]`var("$x")` +
|
||||
[red]`Eval Error: var(): unknown variable "$x"`
|
||||
|
||||
==== Module "fmt"
|
||||
|
||||
===== print()
|
||||
@ -1325,18 +1353,31 @@ This function allows you to define variables whose names must include special ch
|
||||
===== println()
|
||||
|
||||
==== Module "import"
|
||||
Module actiovation: +
|
||||
|
||||
===== _import()_
|
||||
[blue]_import([grey]#<source-file>#)_ -- loads the multi-expression contained in the specified source and returns its value.
|
||||
Syntax: +
|
||||
`{4sp}import(<source-file>)`
|
||||
|
||||
Loads the multi-expression contained in the specified source and returns its value.
|
||||
|
||||
===== _importAll()_
|
||||
|
||||
==== Module "iterator"
|
||||
|
||||
===== run()
|
||||
Syntax: +
|
||||
`{4sp}run(<iterator>, <operator>, <vars>) -> any`
|
||||
|
||||
Iterates over the specified iterator and applies the specified operator to the current value of the iterator.
|
||||
|
||||
==== Module "math.arith"
|
||||
Currently, the "math.arith" module provides two functions, add() and mul(), that perform addition and multiplication of an arbitrary number of parameters. More functions will be added in the future.
|
||||
|
||||
* <<_add,add()>>
|
||||
* <<_mul,mul()>>
|
||||
|
||||
|
||||
===== add()
|
||||
Syntax: +
|
||||
`{4sp}add(<num-expr1>, <num-expr2>, ...) -> any` +
|
||||
|
||||
Loading…
Reference in New Issue
Block a user