29 lines
595 B
Markdown
29 lines
595 B
Markdown
## Practical Example
|
|
|
|
Below is a practical example illustrating the definition and invocation of a function in AVAP™:
|
|
|
|
### Definition of a Function to Calculate the Area of a Circle
|
|
|
|
```javascript
|
|
function calculate_circle_area(radius){
|
|
return(3.14 * radius ** 2)
|
|
}`
|
|
|
|
}
|
|
```
|
|
|
|
### Calling the Function
|
|
|
|
```javascript
|
|
{`circle_radius = 5
|
|
area = calculate_circle_area(circle_radius)
|
|
result = "The area of the circle is: %s" % area
|
|
addResult(result)
|
|
```
|
|
|
|
### Output:
|
|
|
|
```javascript
|
|
The area of the circle is: 78.5
|
|
```
|