⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testnested.out

📁 格式化源码的最新板
💻 OUT
字号:
unit TestNested;

{ AFS 11 Jan 2000
 This unit compiles but is not semantically meaningfull
 it is test cases for the code formatting utility

 This unit uses nested procs
}
interface

implementation

uses SysUtils;

function Fred: string;
begin
  Result := IntToStr(Random(20));
end;

function Fred2: string;

  function GetARandomNumber: integer;
  begin
    Result := Random(20);
  end;

begin
  Result := IntToStr(GetARandomNumber);
end;

function Fred3: string;

  function GetARandomNumber: integer;

    function GetLimit: integer;
    begin
      Result := 20;
    end;

  begin
    Result := Random(GetLimit);
  end;

begin
  Result := IntToStr(GetARandomNumber);
end;


{ the same agian, with more complexity - parameters, local vars and constants }
procedure Jim1(var ps1: string; const ps2: string);
const
  FRED = 'Jim1';
var
  ls3: string;
begin
  ls3 := FRED;
  ps1 := ls3 + ps2;
end;

procedure Jim2(var ps1: string; const ps2: string);
const
  FRED = 'Jim2';

  function GetARandomNumber: integer;
  var
    liLimit: integer;
  begin
    liLimit := 10 * 2;
    Result  := Random(liLimit);
  end;

var
  ls3: string;
begin
  ls3 := FRED;
  ps1 := ls3 + IntToStr(GetARandomNumber) + ps2;
end;


procedure Jim3(var ps1: string; const ps2: string);
const
  FRED = 'Jim3';
var
  ls3: string;

  function GetARandomNumber: integer;

    function GetLimit: integer;
    const
      HALF_LIMIT = 10;
    begin
      Result := HALF_LIMIT * 2;
    end;

  var
    liLimit: integer;
  begin
    liLimit := GetLimit;
    Result  := Random(liLimit);
  end;

begin
  ls3 := FRED;
  ps1 := ls3 + IntToStr(GetARandomNumber) + ps2;
end;

function MultiPass: integer;

  function One:



  integer;
  begin
    Result := 1;
  end;

  function Two: integer;
  begin
    Result := 2;
  end;

  function Three: integer;
  begin
    Result := 3;
  end;

begin
  Result := One + Two + Three;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -