<?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: fundamental programming questions: semicolon and assignment in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/fundamental-programming-questions-semicolon-and-assignment/m-p/1899416#M1217680</link>
    <description>&lt;P&gt;thanks; my main questions were around control statements while/for loops, etc. which I had seen with and without semicolons. I was thinking that the control statement was essentially starting a kind of unpunctuated block...but if the semi is recommended then stuff like this is valid and recommended?:&lt;/P&gt;
&lt;P&gt;FOR i = 1 to 10;&lt;/P&gt;
&lt;P&gt;LET value = PEEK($(tablename),$(i));&lt;/P&gt;
&lt;P&gt;LET resultStr = resultStr &amp;amp; ', ' &amp;amp; value &amp;amp; '&amp;lt;BR \&amp;gt;';&lt;/P&gt;
&lt;P&gt;NEXT;&lt;/P&gt;
&lt;P&gt;The whole let thing also seems weird but this is part of the mystery of qlik coding.&lt;/P&gt;</description>
    <pubDate>Wed, 02 Mar 2022 14:57:05 GMT</pubDate>
    <dc:creator>daveatkins</dc:creator>
    <dc:date>2022-03-02T14:57:05Z</dc:date>
    <item>
      <title>fundamental programming questions: semicolon and assignment</title>
      <link>https://community.qlik.com/t5/QlikView/fundamental-programming-questions-semicolon-and-assignment/m-p/1898958#M1217659</link>
      <description>&lt;P&gt;Sorry to ask a dumb questions or two but:&lt;/P&gt;
&lt;P&gt;1) is a semicolon recommended to terminate every line? I have found cases where code seems to work without it but lots of inconsistency. The lack of strictness promotes laziness in coding of which I am guilty but I would like to know if there is some purpose or rule.&lt;/P&gt;
&lt;P&gt;2) is it best practice to always assign variables with LET x = whatever? I am familiar with the confusing LET vs SET distinction and how that can be a "feature" but it seems that one can simply say x = 1 and this works as fine as LET x = 1. What is the default behavior; i.e. I say thisDate = today(); or LET thisDay=today()?&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Mar 2022 21:52:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/fundamental-programming-questions-semicolon-and-assignment/m-p/1898958#M1217659</guid>
      <dc:creator>daveatkins</dc:creator>
      <dc:date>2022-03-01T21:52:13Z</dc:date>
    </item>
    <item>
      <title>Re: fundamental programming questions: semicolon and assignment</title>
      <link>https://community.qlik.com/t5/QlikView/fundamental-programming-questions-semicolon-and-assignment/m-p/1898981#M1217660</link>
      <description>&lt;P&gt;1) &lt;A href="https://help.qlik.com/en-US/sense/February2022/Subsystems/Hub/Content/Sense_Hub/Scripting/ScriptRegularStatements/script-regular-statements.htm" target="_blank" rel="noopener"&gt;Script regular statements&lt;/A&gt; must be terminated by a semicolon.&amp;nbsp; &lt;A href="https://help.qlik.com/en-US/sense/February2022/Subsystems/Hub/Content/Sense_Hub/Scripting/ScriptControlStatements/script-control-statements.htm" target="_blank" rel="noopener"&gt;Script control statements&lt;/A&gt;, such as CALL,&amp;nbsp; may be terminated by either a semicolon or end of line.&amp;nbsp; Also the contents of a control statement must be contained within one line.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So semicolons are only optional in control statements, which is a very small number (or zero) of lines in a typical&amp;nbsp; script. I'm not sure why control statements were designed with a different restriction -- perhaps someone else has an explanation.&amp;nbsp; &amp;nbsp;It was years before I even knew that you could use a semicolon on a control statement.&amp;nbsp; I teach beginners to use semicolons on control statements but point out that they are optional because they are likely to encounter script without them.&lt;/P&gt;
&lt;P&gt;2) "thisDate = today()" is the same as "Let thisDate = today()".&amp;nbsp; In my opinion it's a best practice to always include the "Let" so others don't have to wonder what the behavior is.&amp;nbsp; Just my opinion.&lt;/P&gt;
&lt;P&gt;-Rob&lt;BR /&gt;&lt;A href="http://www.easyqlik.com" target="_blank"&gt;http://www.easyqlik.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://masterssummit.com" target="_blank"&gt;http://masterssummit.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://qlikviewcookbook.com" target="_blank"&gt;http://qlikviewcookbook.com&lt;/A&gt;&lt;/P&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>Tue, 01 Mar 2022 23:31:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/fundamental-programming-questions-semicolon-and-assignment/m-p/1898981#M1217660</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2022-03-01T23:31:27Z</dc:date>
    </item>
    <item>
      <title>Re: fundamental programming questions: semicolon and assignment</title>
      <link>https://community.qlik.com/t5/QlikView/fundamental-programming-questions-semicolon-and-assignment/m-p/1899416#M1217680</link>
      <description>&lt;P&gt;thanks; my main questions were around control statements while/for loops, etc. which I had seen with and without semicolons. I was thinking that the control statement was essentially starting a kind of unpunctuated block...but if the semi is recommended then stuff like this is valid and recommended?:&lt;/P&gt;
&lt;P&gt;FOR i = 1 to 10;&lt;/P&gt;
&lt;P&gt;LET value = PEEK($(tablename),$(i));&lt;/P&gt;
&lt;P&gt;LET resultStr = resultStr &amp;amp; ', ' &amp;amp; value &amp;amp; '&amp;lt;BR \&amp;gt;';&lt;/P&gt;
&lt;P&gt;NEXT;&lt;/P&gt;
&lt;P&gt;The whole let thing also seems weird but this is part of the mystery of qlik coding.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Mar 2022 14:57:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/fundamental-programming-questions-semicolon-and-assignment/m-p/1899416#M1217680</guid>
      <dc:creator>daveatkins</dc:creator>
      <dc:date>2022-03-02T14:57:05Z</dc:date>
    </item>
    <item>
      <title>Re: fundamental programming questions: semicolon and assignment</title>
      <link>https://community.qlik.com/t5/QlikView/fundamental-programming-questions-semicolon-and-assignment/m-p/1900809#M1217732</link>
      <description>&lt;P&gt;The semicolons on control statements do look a bit silly when you understand the complete picture.&amp;nbsp; My motivation for teaching beginners to include them is twofold:&lt;/P&gt;
&lt;P&gt;1) Beginners are frequently confused between "control statements" and "regular statements".&amp;nbsp; So I tell them for now,&amp;nbsp; just code the semicolon and will spend our class time on something more useful.&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;2) I'm hoping that if we all use semicolons, I can convince Qlik to allow control statements to span lines so I can write statements like:&lt;/P&gt;
&lt;P&gt;CALL MySub (&lt;BR /&gt;&amp;nbsp; parm1,&amp;nbsp;&lt;BR /&gt;&amp;nbsp; parm2&lt;BR /&gt;);&lt;/P&gt;
&lt;P&gt;So not really a recommendation. More like if I have to fall off the fence one way or another, that's why I fall the way I do.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;-Rob&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Mar 2022 18:46:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/fundamental-programming-questions-semicolon-and-assignment/m-p/1900809#M1217732</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2022-03-03T18:46:14Z</dc:date>
    </item>
  </channel>
</rss>

