Double expression 'else' in pascal

I tried to translate the following Pascal code into C ++ when I came across the "else else" construct in question. I have never seen this before, so can someone tell me what it does and what are the equivalents of C ++ (or maybe C)?

  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;
+4
source share
3 answers

I just copied it to an editor (for example Komodo, where you can choose Pascal as the language for syntax highlighting) and reformatted the text you wrote so that 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 that is now more understandable?

+3
source

begin end, , . (, begin { end }, for(int i = 0; i < 10; i++) SomeCode();, for(int i = 0; i < 10; i++) { SomeCode(); }.

, , , begin end, no-op else , .

Procedure Force(Q: Int64; V, K: Integer);
Var
  i, j, t: Integer;
begin
  if K <= 0 then
  begin
    if (Q >= A) and (Q Mod KK = 0) and (V >= S) and (V <= F) then
      Out := Out + 1;
  end
  else
  begin
    For i := 0 to 9 do
    begin
      if (Q + (i + 1) * h[K - 1] >= A) and (Q + i * h[K - 1] <= B) then
      begin
        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
              begin
                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;
            end;
          end;
        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;
end;
+1

- . , , :

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>=A), .

0

All Articles