Skip to content

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.