Break
Break is a procedure to jump out or quit the looping statement (if, repeat or while). Break is usually called in an if statement.
Example :
program Project1;{$APPTYPE CONSOLE}
uses
SysUtils;
var
number, stop : integer;
begin
write('Conter will be stopped at : ');
readln(stop);
for number := 1 to 1000 do
begin
if number = stop +1 then break;
writeln(number);
end;
readln;
end.
Continue
Continue is a procedure that is used for skipping to next iteration in a looping statement (if, repeat or while). It is also called in an if statement.
Example 1 (writing odd numbers from 1 to 20) :
program Project1;{$APPTYPE CONSOLE}
uses
SysUtils;
var
number : integer;
begin
for number := 1 to 20 do
begin
if Odd(number) then continue;
writeln(number);
end;
readln;
end.
Example 2 (writing even numbers from 1 to 20) :
program Project1;{$APPTYPE CONSOLE}
uses
SysUtils;
var
number : integer;
begin
for number := 1 to 20 do
begin
if not Odd(number) then continue;
writeln(number);
end;
readln;
end.
You can download the complete code here.
Is it me or have you reversed the logic of Odd/even?
ReplyDeletesupplier of 3D printing, rapid prototyping, rapid manufacturing, plastic fabrication, tooling, CNC and injection molding services.
ReplyDeletes The best and a lot of secret drop-shipping suppliers in the world which will provide your products globally available for you directly to your customers doors. Also get the best drop-shipping manufacturer on your organization.
Deletethank you for the code , but i am still donnot get it, anyways if you wish high quality injection moulds form china please let me know
DeleteOur advantages:
ReplyDeletewilling to deliver as quick as possible /AQAP (as quick as possible)
western management led by industrial designers who will advise you the right technology.