<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: The difference between glue and if in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/The-difference-between-glue-and-if/m-p/60211#M32839</link>
    <description>&lt;P&gt;An "If()" function has the structure of:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( condition,
     run this if the condition is true
,
     run this if the condition is false
)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;An example would be&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( :sex == "F",
     Show("This is a Female")
,
     Show("This is a Male")
)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now, where a "Glue" character comes into play, is if in the true or false sections, more than one statement needs to be executed, the statements need to be "Glued" together to show that the true or false section one complete item.&amp;nbsp; So if both: Show("This is a Female") and Gender = "Female" needs to be executed you need to "Glue" the statements together&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( :sex == "F",
     Show("This is a Female");
     Gender = "Female"
,
     Show("This is a Male")
)&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 12 Jun 2018 22:04:14 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2018-06-12T22:04:14Z</dc:date>
    <item>
      <title>The difference between glue and if</title>
      <link>https://community.jmp.com/t5/Discussions/The-difference-between-glue-and-if/m-p/60206#M32838</link>
      <description>&lt;P&gt;Could someone gives me some insprision about the differences between glue and if in jmp? I got so confused.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot!&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jun 2018 21:01:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/The-difference-between-glue-and-if/m-p/60206#M32838</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-06-12T21:01:24Z</dc:date>
    </item>
    <item>
      <title>Re: The difference between glue and if</title>
      <link>https://community.jmp.com/t5/Discussions/The-difference-between-glue-and-if/m-p/60211#M32839</link>
      <description>&lt;P&gt;An "If()" function has the structure of:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( condition,
     run this if the condition is true
,
     run this if the condition is false
)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;An example would be&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( :sex == "F",
     Show("This is a Female")
,
     Show("This is a Male")
)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now, where a "Glue" character comes into play, is if in the true or false sections, more than one statement needs to be executed, the statements need to be "Glued" together to show that the true or false section one complete item.&amp;nbsp; So if both: Show("This is a Female") and Gender = "Female" needs to be executed you need to "Glue" the statements together&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( :sex == "F",
     Show("This is a Female");
     Gender = "Female"
,
     Show("This is a Male")
)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Jun 2018 22:04:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/The-difference-between-glue-and-if/m-p/60211#M32839</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2018-06-12T22:04:14Z</dc:date>
    </item>
    <item>
      <title>Re: The difference between glue and if</title>
      <link>https://community.jmp.com/t5/Discussions/The-difference-between-glue-and-if/m-p/60212#M32840</link>
      <description>&lt;P&gt;&lt;A href="https://www.jmp.com/support/help/14/alternatives-for-gluing-expressions-together.shtml#518174" target="_self"&gt;Glue()&lt;/A&gt; and &lt;A href="https://www.jmp.com/support/help/14/if.shtml#246633" target="_self"&gt;If()&lt;/A&gt; are – almost – completely unrelated, so it's hard to compare them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="5"&gt;&lt;STRONG&gt;Glue&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;In all honesty, you can ignore Glue() and be a very successful JSL programmer.&amp;nbsp;So, if this confuses you, don't worry about it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;JSL is a functional language. That is, everything(ish) in JSL is a function. Some functions in JMP have operator forms.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example, the function to assign a value to a variable is&amp;nbsp;&lt;A href="https://www.jmp.com/support/help/14/assignment-functions-2.shtml#2439111" target="_self"&gt;Assign(a, b)&lt;/A&gt;, which assigns the value of b into a.&amp;nbsp;There is an operator form of that using an = sign:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;a=b&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The function that puts&amp;nbsp;expressions together into something that can be evaluated is Glue(), as in:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Glue(Assign(a,b), Add(c,d))&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The operator form of Glue() is a semicolon (;), the following is the equivalent of the above:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Assign(a,b);
Add(c, d)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;FONT size="5"&gt;&lt;STRONG&gt;If&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;In any programmming language you need constructs&amp;nbsp;to make decisions. In JSL, as in other languages, these are &lt;A href="https://www.jmp.com/support/help/14/conditional-functions-2.shtml#291518" target="_self"&gt;condtional functions&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If() takes at least three arguments:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;a condtional&lt;/LI&gt;
&lt;LI&gt;true&amp;nbsp;result&lt;/LI&gt;
&lt;LI&gt;else&amp;nbsp;result&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;I find it easiest to understand If() by looking at it's prototype in the Formula Editor.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JMPScreenSnapz225.png" style="width: 206px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/11121iFA7806E6C0B90F02/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JMPScreenSnapz225.png" alt="JMPScreenSnapz225.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Notice the first "expr" there. That's the condition to be tested and it's the first argument. The second argument, the "then clause", is the expression that should be evaluated if the condition is true. The third argument is the "else clause," the expression to be evaluated if the condition isn't true.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Outside of the formula editor this looks like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( a == "some value",
	Show( "True" ),
	Show( "False" )
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So, this tests the condition that a is equal to "some value" and shows "True" if it is and "False" if it isn't.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Each of the clauses can contain multiple statements, separated by semicolons (;).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this helps clear up some confusion.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you've got more questions, let us know.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jun 2018 22:08:22 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/The-difference-between-glue-and-if/m-p/60212#M32840</guid>
      <dc:creator>Jeff_Perkinson</dc:creator>
      <dc:date>2018-06-12T22:08:22Z</dc:date>
    </item>
    <item>
      <title>Re: The difference between glue and if</title>
      <link>https://community.jmp.com/t5/Discussions/The-difference-between-glue-and-if/m-p/60228#M32850</link>
      <description>&lt;P&gt;Thank you so much Jim! It is so helpful for me!&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jun 2018 12:41:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/The-difference-between-glue-and-if/m-p/60228#M32850</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-06-13T12:41:15Z</dc:date>
    </item>
    <item>
      <title>Re: The difference between glue and if</title>
      <link>https://community.jmp.com/t5/Discussions/The-difference-between-glue-and-if/m-p/60229#M32851</link>
      <description>&lt;P&gt;Thank you so much Jeff! Your answer gives me a clear picture of how to use JMP in the future!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jun 2018 12:42:40 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/The-difference-between-glue-and-if/m-p/60229#M32851</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-06-13T12:42:40Z</dc:date>
    </item>
  </channel>
</rss>

