'DataWeave Conditional lookup

I have tried below code, but it’s throwing run time error

%dw 2.0
output application/json

fun CodeCalculator(Code) = if(Code == "abc") {
        lookup("code1-flow",Code,2000) 
    } 
    else {
        lookup("code2-flow",Code,2000)
        }
---

{
    "code": CodeCalculator(abc)
}

Please help me understand where it go wrong.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source