assistance-engine/docs/developer.avapframework.com/chapter14_2.md

25 lines
580 B
Markdown

## Function Construction
In AVAP™, similar to Python, functions are defined using the keyword `function` , followed by the function name and its parameters in parentheses. The function definition ends with a ( `{` ), followed by the block of code that forms the function body, and closed by (`}`).
### Defining a function in AVAP™
```javascript
function greet(name){
return("Hello, " + name + "!")
}
```
### Calling the function
```javascript
message = greet("World")
addResult(message)
```
### Output
```javascript
Hello, World!
```