Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-41422

Assignment in if statements does not work

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      The following fails in pipeline scripts (the if statement always evaluates to false)

      def getStatus(){
       // ....
       "Ready"
      }
      
      //....
      
      
      def acceptedStatuses = ["Ready", "Updated", "Failed" ]
      def status
      if(acceptedStatuses.contains((status = getStatus()))){
         // never called
      }
      
      
      

        Attachments

          Activity

          There are no comments yet on this issue.

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            zhelyan Zhelyan Panchev
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated: