<?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: unable to pass string to function in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/unable-to-pass-string-to-function/m-p/434078#M68382</link>
    <description>&lt;P&gt;I am not seeing an issue.&amp;nbsp;Below is your code, with a Show() function, that gives results that indicates the string variables are passed in.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// function
C_SC_PC_func2 = Function( {SheetName, selSRM},
	{};
	Show( sheetname, selsrm );
);

//call function
C_SC_PC_func2( "string1", "string2" );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;sheetname = "string1";
selsrm = "string2";&lt;/PRE&gt;</description>
    <pubDate>Mon, 08 Nov 2021 13:54:58 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2021-11-08T13:54:58Z</dc:date>
    <item>
      <title>unable to pass string to function</title>
      <link>https://community.jmp.com/t5/Discussions/unable-to-pass-string-to-function/m-p/433997#M68381</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I am trying to pass to string to function, but its no working.&lt;/P&gt;
&lt;P&gt;could someone advise what I do wrong?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// function
C_SC_PC_func2 = Function( 
    {SheetName, selSRM}, 
    {}, 
);

//call function
C_SC_PC_func2( "string1", "string2" );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 18:04:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/unable-to-pass-string-to-function/m-p/433997#M68381</guid>
      <dc:creator>AdirZig</dc:creator>
      <dc:date>2023-06-09T18:04:42Z</dc:date>
    </item>
    <item>
      <title>Re: unable to pass string to function</title>
      <link>https://community.jmp.com/t5/Discussions/unable-to-pass-string-to-function/m-p/434078#M68382</link>
      <description>&lt;P&gt;I am not seeing an issue.&amp;nbsp;Below is your code, with a Show() function, that gives results that indicates the string variables are passed in.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// function
C_SC_PC_func2 = Function( {SheetName, selSRM},
	{};
	Show( sheetname, selsrm );
);

//call function
C_SC_PC_func2( "string1", "string2" );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;sheetname = "string1";
selsrm = "string2";&lt;/PRE&gt;</description>
      <pubDate>Mon, 08 Nov 2021 13:54:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/unable-to-pass-string-to-function/m-p/434078#M68382</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-11-08T13:54:58Z</dc:date>
    </item>
    <item>
      <title>Re: unable to pass string to function</title>
      <link>https://community.jmp.com/t5/Discussions/unable-to-pass-string-to-function/m-p/434110#M68387</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/31552"&gt;@AdirZig&lt;/a&gt;&amp;nbsp; - you want the comma, not the semicolon, to make a list of local variables in the function. (Your list was empty, and I often start my function definitions with an empty list too.)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// function
C_SC_PC_func2 = Function( {SheetName, selSRM},
	{i,j}, // use comma
	i=3;
	j=4;
	Show( sheetname, selsrm );
);

//call function
i = j = 0;
C_SC_PC_func2( "string1", "string2" );
show(i,j);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;JMP looks at the &lt;EM&gt;function&lt;/EM&gt; function to see if it has three arguments. If it does, and the second argument is a list, it is a list of local variables. If you use a semicolon (making two arguments to &lt;EM&gt;function&lt;/EM&gt;), it becomes a statement in the function body that is evaluated and thrown away.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Nov 2021 14:52:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/unable-to-pass-string-to-function/m-p/434110#M68387</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2021-11-08T14:52:05Z</dc:date>
    </item>
  </channel>
</rss>

