Pascal Question

# Double 'else' statement in pascal

I was trying to translate the following Pascal code to C++, when I stumbled upon the "else else" construction in question. I've never seen this before, so could anybody tell me what it does and what are it's C++ (or maybe C) equivalents?

``````  Procedure Force(Q:Int64;V,K:Integer);
Var i,j,t:Integer;
begin
if K<=0 then
if (Q>=A)and(Q Mod KK =0)and(V>=S)and(V<=F)then Out:=Out+1 else else
For i:=0 to 9 do
if (Q+(i+1)*h[k-1]>=A)and(Q+i*h[k-1]<=B) then
if (Q+(i+1)*h[K-1]<B)and(Q+i*h[k-1]>=A) then
Begin
M:=(Q+i*h[k-1]) Mod KK;
For j:=0 to 9*(K-1) do
For t:=0 to KK-1 do
if D[K-1,j,t]>0 then
if (V+i+j>=S)and(V+i+j<=F)and((t+M) Mod KK=0) then
Out:=Out+D[K-1,j,t];
end else
if Odd(N-K+1) then Force(Q+i*h[k-1],V+i,K-1) else
Force(Q+i*h[k-1],V+i,K-1);
end;
``````

I've just copied to an editor (for instance Komodo, where you can select Pascal as language for syntax color highlighting) and reformatted the text you've wrote in a way I can read it myself.

``````procedure Force(Q:Int64;V,K:Integer);
var
i,j,t:Integer;
begin
if K<=0 then
if (Q>=A) and (Q Mod KK =0) and (V>=S) and (V<=F) then
Out:=Out+1
else
else
for i:=0 to 9 do begin
if (Q+(i+1)*h[k-1]>=A) and (Q+i*h[k-1] <= B) then
if (Q+(i+1)*h[K-1]<B) and (Q+i*h[k-1] >= A) then begin
M := (Q+i*h[k-1]) Mod KK;
for j:=0 to 9*(K-1) do begin
for t:=0 to KK-1 do begin
if D[K-1,j,t] > 0 then
if (V+i+j >= S) and (V+i+j <= F) and ((t+M) mod KK = 0) then
Out:=Out+D[K-1,j,t];
end; {for t}
end; {for j}
end else
if Odd(N-K+1) then
Force(Q+i*h[k-1],V+i,K-1)
else
Force(Q+i*h[k-1],V+i,K-1);
end;
end;
end;
``````

Don't you think it is more understandable now?

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download