Razlike između izmjena na stranici "Goto"

Dodana 1.002 bajta ,  prije 1 godinu
m
m
 
== Primjeri ==
 
=== Pascal ===
 
<source lang="pascal" highlight="25">
{$id: ALGMD-20100530}
unit Harmful;
 
interface(*********************************************************************)
 
function ProdOfInts(Op1, Op2: LongInt): LongInt;
function PowerOfInt(Base: LongInt; Exp: LongInt): LongInt;
 
implementation(****************************************************************)
 
var
Result: LongInt;
 
function ProdOfInts(Op1, Op2: LongInt): LongInt;
label
0, 1;
begin
0:
Result := 0;
1:
Result := Result + Op1;
Op2 := Op2 - 1;
 
if Op2 <> 0 then
goto 1
else if Op2 = 0 then
ProdOfInts := Result;
end;
 
function PowerOfInt(Base: LongInt; Exp: LongInt): LongInt;
begin
Result := 1;
 
while Exp <> 0 do
begin
Exp := Exp - 1;
Result := ProdOfInts(Base, Result);
end;
 
PowerOfInt := Result;
end;
 
begin(********************************************************************)end.
</source>
 
=== Windows CMD ===
 
<source lang="dos" highlight="109, 15, 20">
@echo off
 
setlocal
cls
set project=Harmful
@fpc program.ppset options=-Sg -WN -Xs -XX
pause
 
call :main
if exist program.exe (
endlocal
@program.exe
goto :eof
 
:main
fpc %project%.pp %options%
 
if exist program%project%.exepp* (
goto :eof
) else (
gotocall :errerror
)
 
goto :eof
exit
 
:error
:err
echo.:
echo Compilation error.
pause
 
exit
:eof
</source>
 
576

izmjena