groovy

Syntax of compound IF statement in Groovy


how to write compound If statement in Groovy

for ex:

if (OrderItemType != T) || 
   (OrderItemType == D && NumberRequiredLevel != null) || 
   (OrderItemType == D && NumberRequiredLevel != "")

Is this syntax is right?

Thanks & Regards, Sateesh


Solution

  • should be changed to this since the proper syntax is "if ()" (You need extra brackets)

    if (
        (OrderItemType != T) || 
        (OrderItemType == D && NumberRequiredLevel != null) || 
        (OrderItemType == D && NumberRequiredLevel != "")
    ) { ... }