[Template fetch failed for http://spivey.oriel.ox.ac.uk/corner/Template:Sitenotice?action=render: HTTP 404]

Example.p: Difference between revisions

From Compilers
Jump to navigation Jump to search
(Created page with "(* An example of control structures with short-circuit conditions *) begin i := 0; d := -1; m := 35; while (i < 10) and (d < 0) do if (i > 1) and (m mod i = 0) then...")
 
No edit summary
 
Line 1: Line 1:
<pre>
(* An example of control structures with short-circuit conditions *)
(* An example of control structures with short-circuit conditions *)


Line 11: Line 12:
   print m; newline
   print m; newline
end.
end.
</pre>

Latest revision as of 10:19, 24 October 2023

(* An example of control structures with short-circuit conditions *)

begin
  i := 0; d := -1; m := 35;
  while (i < 10) and (d < 0) do
    if (i > 1) and (m mod i = 0) then
      d := i
    end;
    i := i+1
  end;
  print m; newline
end.