Can "When" like keyword be used in scripted pipeline? stage('My Conditional Stage') {
    when {
        branch 'master'
    }
    steps {
        echo 'Do that only on master branch'
    }
}


For Scripted pipeline ; if value of i is 0 then we need skip the stages ; obviously we can put a conditional logic by surrounding the stage but if we do that the UI doesn't show it like it skipped
A Scripted Pipeline is literally a Groovy script, so you can just use if/else conditionals like you would in a normal Groovy script.

if (env.BRANCH_NAME == 'master') {
  // do steps here
} else {
  // do other steps here
}