You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.
Oussama Essamadi edited this page Mar 24, 2024
·
2 revisions
LangKama supports the creation and use of functions, enabling the encapsulation and reuse of code blocks. Functions in LangKama can take parameters, perform operations, and return results. This section describes how to define and invoke functions in LangKama.
Function Definition
To define a function in LangKama, use the let me cook keyword, followed by the function name and its parameters enclosed in parentheses. The function body is enclosed in curly braces {}. A function can return a value using the reda keyword. Because Reda™ has to take credit somehow.
let me cook add(a, b) {
reda a + b.
}
This defines a function named add that takes two parameters, a and b, and returns their sum.
Invoking Functions
To invoke a function, simply call it by its name followed by the arguments enclosed in parentheses.
add(1, 2).
This calls the add function with arguments 1 and 2, and the function returns the sum 3.