-
Notifications
You must be signed in to change notification settings - Fork 0
Passing by value
Julius Paffrath edited this page Feb 18, 2025
·
1 revision
Jasks default behaviour when passing variables as parameters, is passing by value. This means, that no reference to the original variable is passed to the function, allowing you to work with a copy inside the function:
function editValue(str)
assign "New Value" to str
end
store "Old Value" in myStr
editValue(myStr)
This code will not modify the variable outside the functions scope, because when calling the function, a dedicated copy of all parameters is created on the functions heap. If you want to access variables outside of a functions scope, you can use the Access Operator.
- Home
- Getting started
- Control flow
- Functions
- Passing by value
- List variables in jask
- Dictionary variables in jask
- Structs in jask
- Convert variables
- Internal Functions
- The access operator
- Callbacks in jask
- Modules
- Internal Modules
- The jask standard library jcore
- Using CMD arguments in jask
- Nested function calls
- Functions inside functions!
- Modules inside functions!
- Performance comparison of loops