18 January 2026:


This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.



Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.

Nested else-if statements?

kyoobkyoob Members
edited April 2013 in Sahi - Open Source
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");
}
}

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

Sign In or Register to comment.