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

Example.p

From Compilers
Revision as of 10:18, 24 October 2023 by Mike (talk | contribs) (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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

(* 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.