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

630 B

5.3. Advanced Example

Consider the following example where multiple files are imported:

Content of the file main.avap
addVar(5, a) 
include utilities.avap 
include operations.avap

addVar(b, increment(a))
addVar( c, multiply(b, 2))
addResult(c)

Content of the file utilities.avap
function increment(x){
    return(x + 1)
}
Content of the file operations.avap
function multiply(x, y){ 
    return(x * y)
}

In this example, utilities.avap and operations.avap are imported into main.avap at the specified points, allowing the increment and multiply functions to be used in main.avap .