我必须检查emc值和联系值,但是我想在不使用pipeline {
agent any
stages {
stage('pre-step-1') {
steps {
// call job #1 here
}
}
stage('pre-step-2') {
steps {
// call job #2 here. I skipped 3 cause I'm lazy.
}
}
stage('pre-step-4') {
steps {
// call job #4 here
}
}
}
}
的情况下为emc和联系提供特定的错误消息。
elseif
答案 0 :(得分:2)
您可以使用2个独立的IF语句来检查值,如下所示:
$emailerror = '';
$contacterror = '';
if ($emc > 0)
{
$emailerror="E-mail id is already registred";
}
if (strlen($contact)!=10 || !is_numeric($contact))
{
$contacterror="Wrong Number";
}
您还可以使用三元运算符::
$emailerror = ( $emc > 0 ) ? "E-mail id is already registred" : "";
$contacterror = ( strlen($contact)!=10 || !is_numeric($contact) ) ? "Wrong Number" : "";