[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: if then else nesting



PureBytes Links

Trading Reference Links

Thanks Gary. I hoped it would be something simple I overlooked, like begin
and end should surround each condition subsequent to the first occurrence
(even though it's stating the obvious).

> It seems that nesting if then else more than 2 occurrences doesn't
> work, even though it verifies as syntactically correct. If that's
> so, how does one do the equivalent of a case statement in EL?

It works for me.  This code is nested 8 deep.  Maybe you don't have
your if/then/else's matched up right?

Gary


if mod(BarNumber,8) = 0 then begin
  print(BarNumber:5:0,":  mod = 0");
  end
else begin
  if mod(BarNumber,8) = 1 then begin
    print(BarNumber:5:0,":  mod = 1");
    end
else begin
  if mod(BarNumber,8) = 2 then begin
    print(BarNumber:5:0,":  mod = 2");
    end
else begin
  if mod(BarNumber,8) = 3 then begin
    print(BarNumber:5:0,":  mod = 3");
    end
else begin
  if mod(BarNumber,8) = 4 then begin
    print(BarNumber:5:0,":  mod = 4");
    end
else begin
  if mod(BarNumber,8) = 5 then begin
    print(BarNumber:5:0,":  mod = 5");
    end
else begin
  if mod(BarNumber,8) = 6 then begin
    print(BarNumber:5:0,":  mod = 6");
    end
else begin
  if mod(BarNumber,8) = 7 then begin
    print(BarNumber:5:0,":  mod = 7");
    end;
end;
end;
end;
end;
end;
end;
end;
if false then plot1(0,"");