Is it possible to split script block into several parts? #4536
Answered
by
bentsherman
lishengting
asked this question in
Q&A
-
Just like
Is this possible? Thanks! |
Beta Was this translation helpful? Give feedback.
Answered by
bentsherman
Nov 22, 2023
Replies: 1 comment 1 reply
-
Yes, all you need to do is return a string at the end. In this case, you can build up the string piece by piece: process multi_script_block {
script:
def cmd = """
#block1
"""
if (params.a) {
cmd += """
#block2
"""
}else{
cmd += """
#block3
"""
}
cmd += """
#block4
"""
return cmd
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
lishengting
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes, all you need to do is return a string at the end. In this case, you can build up the string piece by piece: