mirror of
https://github.com/sagiegurari/duckscript
synced 2024-10-14 11:53:05 +00:00
docs
This commit is contained in:
parent
7a55aeec49
commit
56c635b949
|
@ -4,7 +4,10 @@ CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = "true"
|
|||
CARGO_MAKE_BINARY_EXECUTABLE_NAME = "duck"
|
||||
|
||||
[env.sdk]
|
||||
CARGO_MAKE_WORKSPACE_INCLUDE_MEMBERS = "duckscript_sdk;duckscript_cli"
|
||||
CARGO_MAKE_WORKSPACE_INCLUDE_MEMBERS = [
|
||||
"duckscript_sdk",
|
||||
"duckscript_cli"
|
||||
]
|
||||
|
||||
[env.cli]
|
||||
CARGO_MAKE_WORKSPACE_INCLUDE_MEMBERS = "duckscript_cli"
|
||||
|
|
|
@ -16,7 +16,7 @@ When a function command is detected, it will search for the end command that com
|
|||
That entire block is considered the function code block (functions cannot be nested in outer functions)<br>
|
||||
|
||||
In order to invoke the function, simply call the function name with any amount of paramters.<br>
|
||||
Those parameters will be set as $1, $2, ... and so on.<br>
|
||||
Those parameters will be set as ${1}, ${2}, ... and so on.<br>
|
||||
Since variables are global, it will overwrite any older values stored in those variables.<br>
|
||||
|
||||
To exist a function and return a value, simply use the **return** command with the value you want to return.<br>
|
||||
|
@ -29,7 +29,7 @@ In case the code reached the **end** call, the function will exist but will retu
|
|||
* function - The function name used later on to invoke the function
|
||||
* end - no parameters
|
||||
* return - optional single paramter to return as an output of the function call
|
||||
* *function name* - Any number of arguments which will automatically be set as global variables: $1, $2, ... as so on.
|
||||
* *function name* - Any number of arguments which will automatically be set as global variables: ${1}, ${2}, ... as so on.
|
||||
|
||||
#### Return Value
|
||||
|
||||
|
@ -61,8 +61,8 @@ echo ${text}
|
|||
|
||||
# Example of passing arguments
|
||||
fn print_input
|
||||
# $1 is set with the value 'hello'
|
||||
# $2 is set with the value 'world'
|
||||
# ${1} is set with the value 'hello'
|
||||
# ${2} is set with the value 'world'
|
||||
echo ${1} ${2}
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue