<?xml version="1.0" encoding="utf-8" ?> <!-- for emacs: -*- coding: utf-8 -*- --> <!-- Apache may like this line in the file .htaccess: AddCharset utf-8 .html --> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg-flat.dtd" > <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head><title>continue -- continue with the next iteration of a loop</title> <link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/> </head> <body> <table class="buttons"> <tr> <td><div><a href="_contract.html">next</a> | <a href="_content_lp__Ring__Element_rp.html">previous</a> | <a href="_contract.html">forward</a> | <a href="_content_lp__Ring__Element_rp.html">backward</a> | up | <a href="index.html">top</a> | <a href="master.html">index</a> | <a href="toc.html">toc</a> | <a href="http://www.math.uiuc.edu/Macaulay2/">Macaulay2 web site</a></div> </td> </tr> </table> <hr/> <div><h1>continue -- continue with the next iteration of a loop</h1> <div class="single"><h2>Synopsis</h2> <ul><li><div class="list"><dl class="element"><dt class="heading">Usage: </dt><dd class="value"><div><tt>continue x</tt></div> </dd></dl> </div> </li> <li><div class="single">Inputs:<ul><li><span><tt>x</tt></span></li> </ul> </div> </li> <li><div class="single">Consequences:<ul><li>the currently executing <tt>list</tt>-clause of a <a href="_for.html" title="for loops">for</a>-loop or <a href="_while.html" title="while loops">while</a>-loop is finished, and iteration continues with the <a href="_do.html" title="loop control">do</a>-clause or the next iteration of the loop, if any. The value <tt>x</tt> is added to the list being accumulated. If <tt>x</tt> is omitted, then no value is added to the list, and the statement may be used in a <tt>do</tt>-clause.</li> <li>Alternatively, as a deubgger command, causes execution to be resumed, starting with the current expression.</li> </ul> </div> </li> </ul> </div> <div class="single"><h2>Description</h2> <div><table class="examples"><tr><td><pre>i1 : for i from 1 to 4 list (continue 4; print ho) do print hi hi hi hi hi o1 = {4, 4, 4, 4} o1 : List</pre> </td></tr> <tr><td><pre>i2 : for i from 1 to 4 list (continue ; 14) do print hi hi hi hi hi o2 = {} o2 : List</pre> </td></tr> <tr><td><pre>i3 : for i from 1 to 4 list 14 do print hi hi hi hi hi o3 = {14, 14, 14, 14} o3 : List</pre> </td></tr> <tr><td><pre>i4 : i = 0 ; while i < 10 do ( i = i+1; if i == 5 then continue ; print i ) 1 2 3 4 6 7 8 9 10</pre> </td></tr> </table> <p>Here is an example of the use of <a href="_continue.html" title="continue with the next iteration of a loop">continue</a> in the debugger after altering a value so continuation will not cause the error to recur.</p> <table class="examples"><tr><td><pre>i6 : load "Macaulay2Doc/demo1.m2"</pre> </td></tr> <tr><td><pre>i7 : code g o7 = /builddir/build/BUILD/Macaulay2-1.3.1-r10737/Macaulay2/packages/Macaulay2Doc/demo1.m2:11:7-14:8: --source code: g = y -> ( c := f(y-1); d := f(y-2); c+d)</pre> </td></tr> <tr><td><pre>i8 : g 2 /builddir/build/BUILD/Macaulay2-1.3.1-r10737/Macaulay2/packages/Macaulay2Doc/demo1.m2:8:12:(3):[2]: error: division by zero /builddir/build/BUILD/Macaulay2-1.3.1-r10737/Macaulay2/packages/Macaulay2Doc/demo1.m2:8:12:(3):[2]: --entering debugger (type help to see debugger commands) /builddir/build/BUILD/Macaulay2-1.3.1-r10737/Macaulay2/packages/Macaulay2Doc/demo1.m2:8:11-8:13: --source code: b := 1/x;</pre> </td></tr> <tr><td><pre>ii9 : code f oo9 = /builddir/build/BUILD/Macaulay2-1.3.1-r10737/Macaulay2/packages/Macaulay2Doc/demo1.m2:6:8-9:8: --source code: f := x -> ( a := "hi there"; b := 1/x; b+1)</pre> </td></tr> <tr><td><pre>ii10 : x oo10 = 0</pre> </td></tr> <tr><td><pre>ii11 : x = 11 oo11 = 11</pre> </td></tr> <tr><td><pre>ii12 : continue 34 o12 = -- 11 o12 : QQ</pre> </td></tr> </table> </div> </div> <div class="waystouse"><h2>For the programmer</h2> <p>The object <a href="_continue.html" title="continue with the next iteration of a loop">continue</a> is <span>a <a href="___Keyword.html">keyword</a></span>.</p> </div> </div> </body> </html>