Skip to content

Is it possible to split script block into several parts? #4536

Answered by bentsherman
lishengting asked this question in Q&A
Discussion options

You must be logged in to vote

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
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@lishengting
Comment options

Answer selected by lishengting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants