<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../style.css">
<title>
Gambas Documentation - Choose
</title>
</head>
<table class="none" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr><td align="left">
<font size="-1">
<a href="../../help+en"><img class="flag" alt="Home" border="0" src="../../img/lang/en.png" align="center"></a>&nbsp;
<a href="../lang+en">Up</a>&nbsp;
<a href="cfloat+en">Previous</a>&nbsp;
<a href="chr+en">Next</a>&nbsp;
</td></tr></table>
<div class="notab">
<h1>
Choose
</h1>
<div class="black"><font size="-2"><b>Syntax</b></font></div>
<pre class="syntax"><u>Value</u> <b>= Choose (</b> <u>Choice</u> <b>,</b> <u>Result #1</u> <b>,</b> <u>Result #2</u> [ <b>,</b> ... ] <b>)</b></pre><p>

This function returns the value of one of its <u>Result #<i>i</i></u> arguments, according to the value of <u>Choice</u>.
<p>
<ul>
<li>If <u>Choice</u> is 1, then <u>Result #1</u> is returned.
<li>If <u>Choice</u> is 2, <u>Result #2</u> is returned, and so on...
<li>If <u>Choice</u> is lower or equal to zero, or if no result value is specified for the value of <u>Choice</u>, then <a href="null+en">NULL</a> is returned.
<p>
</ul>

<div class="gray"><font size="-2"><b>Example</b></font></div>
<pre class="example">X = 3
PRINT Choose(X, &quot;one&quot;, &quot;two&quot;, &quot;three&quot;, &quot;four&quot;)
<hr>three</pre>
<div class="gray"><font size="-2"><b>Example</b></font></div>
<pre class="example">X = 3
PRINT IsNull(Choose(X * 2, &quot;one&quot;, &quot;two&quot;, &quot;three&quot;, &quot;four&quot;))
<hr>True</pre>
<p>
<hr><b>See also</b><br>
<a href="../cat/test+en">Test Control Structures &amp; Functions</a>&nbsp;

</div>
</body>
</html>

