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/5fb01744-46c3-40fd-8d3b-37649b41be69n%40googlegroups.com.