You can code
```
def result = (branch == "main" ? "@daily" : (branch == "master" ? "@hourly" 
: ""))
```
Maybe you find a switch more readable:
```
def result
switch(branch) {
    case "main": result = "@daily"
                           break
    case "master": result = "@hourly"
                               break
    default: result = ""
}
```

[email protected] schrieb am Mittwoch, 1. Juni 2022 um 18:48:02 UTC+2:

> I know you can do terninary operations.  Is it possible to chain them?
>
> so,
> if branch = "main" ? "@daily":""
> if branch = "master" ?" @hourly":""
> and so on?
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/69087581-6d2f-445e-9534-93458b219f65n%40googlegroups.com.

Reply via email to