<?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>throw -- throw an exception</title> <link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/> </head> <body> <table class="buttons"> <tr> <td><div><a href="___Time.html">next</a> | <a href="___Thing_sp_sl_sl_sp__Function.html">previous</a> | <a href="___Time.html">forward</a> | <a href="___Thing_sp_sl_sl_sp__Function.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>throw -- throw an exception</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>throw x</tt></div> </dd></dl> </div> </li> <li><div class="single">Consequences:<ul><li>the flow of control is passed to the surrounding <a href="_catch.html" title="catch a thrown exception">catch</a>, and <tt>x</tt> is returned as its value</li> </ul> </div> </li> </ul> </div> <div class="single"><h2>Description</h2> <div><table class="examples"><tr><td><pre>i1 : catch scan(0..10, i -> if i == 5 then throw 18 else print i) 0 1 2 3 4 o1 = 18</pre> </td></tr> </table> </div> </div> <div class="single"><h2>See also</h2> <ul><li><span><a href="_catch.html" title="catch a thrown exception">catch</a> -- catch a thrown exception</span></li> </ul> </div> <div class="waystouse"><h2>For the programmer</h2> <p>The object <a href="_throw.html" title="throw an exception">throw</a> is <span>a <a href="___Keyword.html">keyword</a></span>.</p> </div> </div> </body> </html>