So I have some code like:
if (document.Insur ance.State.sele ctedIndex == 1)
{
ifIll();
}
else if (document.Insur ance.State.sele ctedIndex == 2)
{
elseKan();
}
else if (document.Insur ance.State.sele ctedIndex == 3)
{
elseInd();
}
I am trying to replace the if-else statements with case statement as
follows:
var index = document.Insura nce.State.selec tedIndex;
switch (index)
{
case 1:
ifIll()
break
case 2:
elseKan()
break
case 3: elseInd()
break
}
This code doesn't work ! Am I missing something here? Thanks
if (document.Insur ance.State.sele ctedIndex == 1)
{
ifIll();
}
else if (document.Insur ance.State.sele ctedIndex == 2)
{
elseKan();
}
else if (document.Insur ance.State.sele ctedIndex == 3)
{
elseInd();
}
I am trying to replace the if-else statements with case statement as
follows:
var index = document.Insura nce.State.selec tedIndex;
switch (index)
{
case 1:
ifIll()
break
case 2:
elseKan()
break
case 3: elseInd()
break
}
This code doesn't work ! Am I missing something here? Thanks
Comment