Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, windows and java based applications. Get your 30 day free trial.
Discuss your Sahi Pro usage patterns, best practices, problems and solutions. Help others solve their problems and seek help from the community when needed. If you need specific support on your application, please email support @ sahipro.com
Discuss your Sahi Pro usage patterns, best practices, problems and solutions. Help others solve their problems and seek help from the community when needed. If you need specific support on your application, please email support @ sahipro.com
Nested else-if statements?
kyoob
Members
Hi, what is the syntax for if-else-if statements in Sahi script? The following failed with a syntax error:
function caseSwitch($htype){
if($htype==22){
type22();
}
else
{if($htype==5){
type5();
}
}
else
{
_log("Whoops, Hierarchy Type " + $htype + " has not been automated yet");
}
}
function caseSwitch($htype){
if($htype==22){
type22();
}
else
{if($htype==5){
type5();
}
}
else
{
_log("Whoops, Hierarchy Type " + $htype + " has not been automated yet");
}
}
Best Answer
-
Hi kyoob,
Please try with the below code,
function caseSwitch($htype)
{
if($htype==22)
{
type22();
}
else if($htype==5)
{
type5();
}
else
{
_log("Whoops, Hierarchy Type " + $htype + " has not been automated yet");
}
}
Good Luck !!
-Umashankar
Answers