<doc>
  <legacy_id>1480</legacy_id>
  <name>value</name>
  <type>function</type>
  <syntax>
    <example>the value of <i>expression</i></example>
    <example>value(<i>expression</i>[,<i>object</i>])</example>
  </syntax>
  <library></library>
  <objects>
  </objects>
  <synonyms>
  </synonyms>
  <classification>
    <category>Values &amp; Properties</category>
  </classification>
  <references>
    <command tag="call">call Command</command>
    <function tag="merge">merge Function</function>
    <operator tag="()">() Operator</operator>
  </references>
  <history>
    <introduced version="1.0">Added.</introduced>
  </history>
  <platforms>
    <mac/>
    <windows/>
    <linux/>
    <ios/>
    <android/>
  </platforms>
  <classes>
    <desktop/>
    <server/>
    <web/>
    <mobile/>
  </classes>
  <security>
  </security>
  <summary><glossary tag="return">Returns</glossary> the <function tag="value">value</function> of an <glossary tag="expression">expression</glossary>.</summary>
  <examples>
    <example>the value of 22 + 3 <i>-- returns 25</i></example>
    <example>value(myVariable) <i>-- returns value of the contents of myVariable</i></example>
    <example>the value of the selectedLine <i>-- returns the actual text of the line</i></example>
    <example>value("the name of me", card 1) <i>-- returns name of card 1</i></example>
  </examples>
  <description>
    <p>Use the <b>value</b> <control_st tag="function">function</control_st> to <glossary tag="evaluate">evaluate</glossary> an <glossary tag="expression">expression</glossary>, or to force LiveCode to <glossary tag="evaluate">evaluate</glossary> an <glossary tag="expression">expression</glossary> within a <glossary tag="statement">statement</glossary>.</p><p/><p><b>Parameters:</b></p><p>The <i>expression</i> is any <glossary tag="expression">expression</glossary>.</p><p/><p>The <i>object</i> is any <href tag="reference/object_reference.rev">object reference</href>.</p><p/><p><b>Value:</b></p><p>The <b>value</b> <control_st tag="function">function</control_st> <glossary tag="return">returns</glossary> a <glossary tag="logical">logical</glossary>, <keyword tag="numeric">numeric</keyword>, or <keyword tag="string">string</keyword> <function tag="value">value</function>, depending on the type of <glossary tag="expression">expression</glossary>.</p><p/><p><b>Comments:</b></p><p>The <b>value</b> <control_st tag="function">function</control_st> can be used as an instant calculator. Any arithmetic <glossary tag="expression">expression</glossary> can be used as the <i>expression</i>, and the <b>value</b> function <glossary tag="return">returns</glossary> the result of the <glossary tag="evaluate">evaluation</glossary>:</p><p/><p>  ask "What do you want to compute?"</p><p>  answer it &amp;&amp; "equals" &amp;&amp; the value of it</p><p/><p>If you specify an <i>object</i>, references to <keyword tag="me">me</keyword> in the <i>expression</i> are treated as references to the <i>object</i>. However, other <href tag="reference/object_reference.rev">object references</href> are treated as though the <glossary tag="handler">handler</glossary> were in the current <glossary tag="object">object's</glossary> <property tag="script">script</property>. For example, "button 3" refers to button 3 on the <glossary tag="current card">current card</glossary>, not the <keyword tag="card">card</keyword> where the <i>object</i> is located.</p><p/><p>If the <i>expression</i> is a single <keyword tag="string">string</keyword>, then even if it is enclosed in quotes, LiveCode attempts to <glossary tag="evaluate">evaluate</glossary> its contents instead of treating it as a <glossary tag="literal string">string literal</glossary>. This means that you must be careful about <glossary tag="literal string">string literals</glossary> that contain <glossary tag="operator">operators</glossary> such as "and".</p>
  </description>
</doc>