Expr-BetweenOps.xml 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
  4. <sect1 id="BETWEEN_Operator">
  5. <title>BETWEEN Operator<indexterm>
  6. <primary>Between Operator</primary>
  7. </indexterm></title>
  8. <para><emphasis>SeekVal </emphasis><emphasis role="bold">BETWEEN<indexterm>
  9. <primary>BETWEEN</primary>
  10. </indexterm> </emphasis><emphasis>LoVal </emphasis><emphasis
  11. role="bold">AND<indexterm>
  12. <primary>AND</primary>
  13. </indexterm> </emphasis><emphasis>HiVal </emphasis></para>
  14. <informaltable colsep="1" frame="all" rowsep="1">
  15. <tgroup cols="2">
  16. <colspec align="left" colwidth="122.40pt" />
  17. <colspec />
  18. <tbody>
  19. <row>
  20. <entry><emphasis>SeekVal</emphasis></entry>
  21. <entry>The value to find in the inclusive range.</entry>
  22. </row>
  23. <row>
  24. <entry><emphasis>LoVal</emphasis></entry>
  25. <entry>The low value in the inclusive range.</entry>
  26. </row>
  27. <row>
  28. <entry><emphasis>HiVal</emphasis></entry>
  29. <entry>The high value in the inclusive range.</entry>
  30. </row>
  31. </tbody>
  32. </tgroup>
  33. </informaltable>
  34. <para>The <emphasis role="bold">BETWEEN</emphasis> operator is shorthand for
  35. an inclusive range check using standard comparison operators
  36. (<emphasis>SeekVal </emphasis>&gt;= <emphasis>LoVal </emphasis>AND
  37. <emphasis>SeekVal </emphasis>&lt;= <emphasis>HiVal). </emphasis>It may be
  38. combined with NOT to reverse the logic.</para>
  39. <para>Example:</para>
  40. <programlisting>X := 10;
  41. Y := 20;
  42. Z := 15;
  43. IsInRange := Z BETWEEN X AND Y;
  44. //This code is directly equivalent to:
  45. // IsInRange := Z &gt;= X AND Z &lt;= Y;
  46. IsNotInRange := Z NOT BETWEEN X AND Y;
  47. //This code is directly equivalent to:
  48. // IsInNotRange := NOT (Z &gt;= X AND Z &lt;= Y);</programlisting>
  49. <para>See Also: <link linkend="Logical_Operators">Logical Operators</link>, <link linkend="Comparison_Operators">Comparison Operators</link></para>
  50. </sect1>