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/a5dae6ab-1128-4d17-98fd-2c5c8af6f51fn%40googlegroups.com.