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

25 lines
587 B
Markdown

## Function Construction
In AVAP™, similar to Python, functions are defined using the keyword `def` , followed by the function name and its parameters in parentheses. The function definition ends with a colon ( `:` ), followed by the block of code that forms the function body, indented with four spaces.
### 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!
```