<?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: Good Coding Practice in BreakPoint</title>
    <link>https://ni.lithium.com/t5/BreakPoint/Good-Coding-Practice/m-p/2162458#M20935</link>
    <description>&lt;P&gt;You are right..&amp;nbsp; I was referring to the name in my snippet.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I should have kept reading further down from the original post.&amp;nbsp; (Left my reading glasses at home... should prove to be an interesting day)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the one from openG.&amp;nbsp; I like the idea that it has the +1 built-in.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://ip1.i.lithium.com/46cf846048b0f37cd534ec14df7533a80c5f6b95/687474703a2f2f666f72756d732e6f70656e672e6f72672f75706c6f6164732f6d6f6e74686c795f30345f323030382f706f73742d313039332d313230383831343932382e706e67" border="0" alt="" title="" align="middle" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To avoid naming confusion with my snippet, the code becomes:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://ni.lithium.com/ni/attachments/ni/BreakPoint/20935/1/RNG.png" border="0" alt="" title="" align="middle" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I also like the polymorphic capability from VI at the bottom of the page from LAVA.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, let's keep the discussion on how to better write code, which is what I have learned in this thread.&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 20 Sep 2012 12:51:01 GMT</pubDate>
    <dc:creator>Ray.R</dc:creator>
    <dc:date>2012-09-20T12:51:01Z</dc:date>
    <item>
      <title>Good Coding Practice</title>
      <link>https://ni.lithium.com/t5/BreakPoint/Good-Coding-Practice/m-p/2162416#M20931</link>
      <description>&lt;P&gt;The idea behind this thread came up as a code sample that I posted as a potential Rube Goldberg code was actually one that touched the topic of good coding practice.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This was the snippet in question:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://ni.lithium.com/ni/attachments/ni/BreakPoint/20914/1/IsItRube.png" border="0" alt="" title="" align="middle" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://ni.lithium.com/t5/BreakPoint/Rube-Goldberg-Code/m-p/2160310#M20914" target="_blank"&gt;Discussed here&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://lavag.org/topic/14981-random-number-integer-numeric-package/page__view__findpost__p__90015" target="_blank"&gt;With a reference to an openG solution here&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;And a suggestion from Altenbach that would result in the following snippet:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://ni.lithium.com/ni/attachments/ni/BreakPoint/20931/1/improvedRNG.png" border="0" alt="" title="" align="middle" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Resulting in the following version of the openG RNG:&amp;nbsp; The control should read "High-1".&amp;nbsp; Or should it say "High+1", since 1000 would result in a range from 0 - 999. So high being 999, High+1 would be 1000.&amp;nbsp; Humm... I wonder if that name would cause confusion..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://ni.lithium.com/ni/attachments/ni/BreakPoint/20931/2/slightlyImprovedOpenG-RNG.png" border="0" alt="" title="" align="middle" /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2012 12:15:41 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/BreakPoint/Good-Coding-Practice/m-p/2162416#M20931</guid>
      <dc:creator>Ray.R</dc:creator>
      <dc:date>2012-09-20T12:15:41Z</dc:date>
    </item>
    <item>
      <title>Re: Good Coding Practice</title>
      <link>https://ni.lithium.com/t5/BreakPoint/Good-Coding-Practice/m-p/2162440#M20934</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://ni.lithium.com/t5/user/viewprofilepage/user-id/2483"&gt;@Ray.R&lt;/a&gt; wrote:&lt;BR /&gt;Resulting in the following version of the openG RNG:&amp;nbsp; The control should read "High-1".&amp;nbsp; Or should it say "High+1", since 1000 would result in a range from 0 - 999. So high being 999, High+1 would be 1000.&amp;nbsp; Humm... I wonder if that name would cause confusion..
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://ni.lithium.com/ni/attachments/ni/BreakPoint/20931/2/slightlyImprovedOpenG-RNG.png" border="0" alt="" title="" align="middle" /&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Ummm...the OpenG code has a +1 in there.&amp;nbsp; So it is named correctly.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2012 12:28:32 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/BreakPoint/Good-Coding-Practice/m-p/2162440#M20934</guid>
      <dc:creator>crossrulz</dc:creator>
      <dc:date>2012-09-20T12:28:32Z</dc:date>
    </item>
    <item>
      <title>Re: Good Coding Practice</title>
      <link>https://ni.lithium.com/t5/BreakPoint/Good-Coding-Practice/m-p/2162458#M20935</link>
      <description>&lt;P&gt;You are right..&amp;nbsp; I was referring to the name in my snippet.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I should have kept reading further down from the original post.&amp;nbsp; (Left my reading glasses at home... should prove to be an interesting day)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the one from openG.&amp;nbsp; I like the idea that it has the +1 built-in.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://ip1.i.lithium.com/46cf846048b0f37cd534ec14df7533a80c5f6b95/687474703a2f2f666f72756d732e6f70656e672e6f72672f75706c6f6164732f6d6f6e74686c795f30345f323030382f706f73742d313039332d313230383831343932382e706e67" border="0" alt="" title="" align="middle" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To avoid naming confusion with my snippet, the code becomes:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://ni.lithium.com/ni/attachments/ni/BreakPoint/20935/1/RNG.png" border="0" alt="" title="" align="middle" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I also like the polymorphic capability from VI at the bottom of the page from LAVA.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, let's keep the discussion on how to better write code, which is what I have learned in this thread.&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2012 12:51:01 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/BreakPoint/Good-Coding-Practice/m-p/2162458#M20935</guid>
      <dc:creator>Ray.R</dc:creator>
      <dc:date>2012-09-20T12:51:01Z</dc:date>
    </item>
    <item>
      <title>Re: Good Coding Practice</title>
      <link>https://ni.lithium.com/t5/BreakPoint/Good-Coding-Practice/m-p/2162814#M20940</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://ni.lithium.com/t5/user/viewprofilepage/user-id/2483"&gt;@Ray.R&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And a suggestion from Altenbach that would result in the following snippet:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://ni.lithium.com/ni/attachments/ni/BreakPoint/20931/1/improvedRNG.png" border="0" alt="" title="" align="middle" /&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This code is still potentially incomplete, because you do not always get a 4 digit number (sometimes it is less than four digits). You should format using "%04d" instead if that is a concern. Now the output is always four digits in the range 0000-9999.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(It is interesting that the rounding operations don't allow output configuration. Since the output is actually always a whole number, an output configuration to a desired integer data type seems useful. &lt;A href="https://ni.lithium.com/t5/LabVIEW-Idea-Exchange/Rounding-operation-should-allow-output-configuration/idi-p/2162836" target="_self"&gt;I see an idea coming&lt;/A&gt;. :D)&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2012 16:02:59 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/BreakPoint/Good-Coding-Practice/m-p/2162814#M20940</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2012-09-20T16:02:59Z</dc:date>
    </item>
    <item>
      <title>Re: Good Coding Practice</title>
      <link>https://ni.lithium.com/t5/BreakPoint/Good-Coding-Practice/m-p/2162996#M20941</link>
      <description>&lt;P&gt;Yes, it would be great if we could format the numeric to string functions.&lt;/P&gt;
&lt;P&gt;Something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://ni.lithium.com/ni/attachments/ni/BreakPoint/20941/1/format.PNG" border="0" alt="" title="" align="middle" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The other thing that would be nice is if the numeric functions like add, subtract, multiply &amp;amp; divide were polymorphic and automatically adapted to the representation that is wired into them.&amp;nbsp; It would save one step by converting to the proper representation.&amp;nbsp; It might also cause people to forget the importance of the proper representations..&amp;nbsp; Well... there's probably enough casting going on out there to justify it.&amp;nbsp; The representations could be set in the property screen for each input and the output.&amp;nbsp; (ie:&amp;nbsp; DBL + INT32 = EXT).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2012 18:09:53 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/BreakPoint/Good-Coding-Practice/m-p/2162996#M20941</guid>
      <dc:creator>Ray.R</dc:creator>
      <dc:date>2012-09-20T18:09:53Z</dc:date>
    </item>
    <item>
      <title>Re: Good Coding Practice</title>
      <link>https://ni.lithium.com/t5/BreakPoint/Good-Coding-Practice/m-p/2163028#M20944</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://ni.lithium.com/t5/user/viewprofilepage/user-id/2483"&gt;@Ray.R&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Yes, it would be great if we could format the numeric to string functions.&lt;/P&gt;
&lt;P&gt;Something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://ni.lithium.com/ni/attachments/ni/BreakPoint/20941/1/format.PNG" border="0" alt="" title="" align="middle" /&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Put that in the Idea Exchange.&amp;nbsp; I'll be more than happy to give it a KUDO.&amp;nbsp; In the mean time, use Format String.&amp;nbsp; You could put in a 4 for the width, but unfortunately it puts in spaces.&amp;nbsp; For what reason? I don't know.&amp;nbsp; I almost always want to pad with zeros.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2012 18:16:15 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/BreakPoint/Good-Coding-Practice/m-p/2163028#M20944</guid>
      <dc:creator>crossrulz</dc:creator>
      <dc:date>2012-09-20T18:16:15Z</dc:date>
    </item>
    <item>
      <title>Re: Good Coding Practice</title>
      <link>https://ni.lithium.com/t5/BreakPoint/Good-Coding-Practice/m-p/2163124#M20947</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://ni.lithium.com/t5/user/viewprofilepage/user-id/2483"&gt;@Ray.R&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Yes, it would be great if we could format the numeric to string functions.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It is called "&lt;A href="https://www.ni.com/docs/en-US/bundle/labview-api-ref/page/functions/format-value.html" target="_self"&gt;format value&lt;/A&gt;" and is in the same palette. (They currently don't accept arrays, but that's why &lt;A href="https://ni.lithium.com/t5/LabVIEW-Idea-Exchange/quot-Scan-value-quot-and-quot-Format-Value-quot-should-accept/idi-p/1042997" target="_self"&gt;this idea&lt;/A&gt; exists. :D)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://ni.lithium.com/ni/attachments/ni/BreakPoint/20947/1/FormatValue.png" border="0" alt="" title="" align="center" /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2026 17:19:56 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/BreakPoint/Good-Coding-Practice/m-p/2163124#M20947</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2026-05-05T17:19:56Z</dc:date>
    </item>
    <item>
      <title>Re: Good Coding Practice</title>
      <link>https://ni.lithium.com/t5/BreakPoint/Good-Coding-Practice/m-p/2163412#M20950</link>
      <description>&lt;P&gt;How about this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://ip1.i.lithium.com/dca382b26cbef5f50280928a59436e878cd2140b/68747470733a2f2f6e692e6c69746869756d2e636f6d2f74352f696d6167652f736572766572706167652f696d6167652d69642f383730383469323344384337333844373642374641352f696d6167652d73697a652f6f726967696e616c3f763d6d70626c2d312670783d2d31" border="0" alt="one way" title="one way" align="middle" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;edit: I think I've missed the point of the thread. Never mind.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Sep 2012 00:25:24 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/BreakPoint/Good-Coding-Practice/m-p/2163412#M20950</guid>
      <dc:creator>Hornless.Rhino</dc:creator>
      <dc:date>2012-09-21T00:25:24Z</dc:date>
    </item>
    <item>
      <title>Re: Good Coding Practice</title>
      <link>https://ni.lithium.com/t5/BreakPoint/Good-Coding-Practice/m-p/2163820#M20958</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://ni.lithium.com/t5/user/viewprofilepage/user-id/7614"&gt;@altenbach&lt;/a&gt; wrote:&lt;BR /&gt;&lt;BR /&gt;
&lt;P&gt;It is called "&lt;A href="https://www.ni.com/docs/en-US/bundle/labview-api-ref/page/functions/format-value.html" target="_self"&gt;format value&lt;/A&gt;" and is in the same palette. (They currently don't accept arrays, but that's why &lt;A href="https://ni.lithium.com/t5/LabVIEW-Idea-Exchange/quot-Scan-value-quot-and-quot-Format-Value-quot-should-accept/idi-p/1042997" target="_self"&gt;this idea&lt;/A&gt; exists. :D)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://ni.lithium.com/ni/attachments/ni/BreakPoint/20947/1/FormatValue.png" border="0" alt="" title="" align="middle" /&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need to use that function more often.&amp;nbsp; Dunno why I left it alone... Maybe because you can't wire an array to it.. &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;This thread is already useful.&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2026 17:20:12 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/BreakPoint/Good-Coding-Practice/m-p/2163820#M20958</guid>
      <dc:creator>Ray.R</dc:creator>
      <dc:date>2026-05-05T17:20:12Z</dc:date>
    </item>
  </channel>
</rss>

