86 lines
4.5 KiB
HTML
86 lines
4.5 KiB
HTML
|
<?xml version="1.0" encoding="utf-8"?>
|
|||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|||
|
<html xmlns:MadCap="http://www.madcapsoftware.com/Schemas/MadCap.xsd" MadCap:lastBlockDepth="6" MadCap:lastHeight="94" MadCap:lastWidth="853" MadCap:disableMasterStylesheet="true" MadCap:tocPath="" MadCap:InPreviewMode="false" MadCap:PreloadImages="false" MadCap:RuntimeFileType="Topic" MadCap:TargetType="WebHelp" lang="en-us" xml:lang="en-us" MadCap:PathToHelpSystem="../../../" MadCap:HelpSystemFileName="Default.xml" MadCap:SearchType="Stem">
|
|||
|
<head><title>LET</title>
|
|||
|
<link href="../../Resources/Stylesheets/BSE_Help.css" rel="stylesheet" />
|
|||
|
<script src="../../SkinSupport/MadCapAll.js" type="text/javascript">
|
|||
|
</script>
|
|||
|
</head>
|
|||
|
<body>
|
|||
|
<h1 class="code">LET</h1>
|
|||
|
<div class="ImagePlusCaption">
|
|||
|
<div class="Col2">
|
|||
|
<p>
|
|||
|
<img src="../../graphics/pgm_icon1.gif" border="0" alt="BS1 icon" title="BS1 icon" />
|
|||
|
</p>
|
|||
|
</div>
|
|||
|
<p style="text-align: right;"> </p>
|
|||
|
</div>
|
|||
|
<p class="clear"> </p>
|
|||
|
<p> </p>
|
|||
|
<p class="PlainText">Syntax: {<span class="keyword_in_text">LET</span>}<i>Variable </i>=<i> Value</i></p>
|
|||
|
<h2>Function</h2>
|
|||
|
<p class="PlainText">Sets <i>Variable</i> equal to the value of <i>Value</i>.
|
|||
|
|
|||
|
</p>
|
|||
|
<ul>
|
|||
|
<li value="1"><b><i>Variable</i></b> is a variable/constant/expression (0-65535).</li>
|
|||
|
<li value="2"><b><i>Value</i></b> is a variable which will be set equal to <i>Value</i>. </li>
|
|||
|
</ul>
|
|||
|
<h2>Explanation<br /></h2>
|
|||
|
<p class="PlainText"><span class="keyword_in_text">LET</span> is an optional instruction for the BASIC Stamp 1 that can be used with variable assignment statements, such as A = 5 and B = A + 2, etc. This instruction is not required and only exits on the BASIC Stamp 1. <span class="keyword_in_text">LET</span> was a commonly used command in early forms of BASIC, and was originally included in the BS1 command set to accommodate programmers from that generation. Parallax recommends that all new BASIC Stamp 1 programs use assignment statements without the <span class="keyword_in_text">LET</span> command.</p>
|
|||
|
<p class="PlainText">The example below demonstrates the use of <span class="keyword_in_text">LET</span> in assignment statements. Note that the Lunchtime and Dinnertime routines do essentially the same type of thing, but the Dinnertime approach is recommended.</p><pre class="BScode" xml:space="preserve">' {$STAMP BS1}
|
|||
|
' {$PBASIC 1.0}
|
|||
|
' {$STAMP BS1}
|
|||
|
|
|||
|
SYMBOL salad = B1
|
|||
|
SYMBOL bread = B2
|
|||
|
SYMBOL soup = B3
|
|||
|
SYMBOL lunch = B4
|
|||
|
SYMBOL dinner = B5
|
|||
|
|
|||
|
Lunchtime:
|
|||
|
LET salad = 3
|
|||
|
LET bread = 1
|
|||
|
LET soup = 4
|
|||
|
lunch = salad + bread + soup
|
|||
|
DEBUG "Lunch = $", #lunch, "plus local tax.", CR
|
|||
|
|
|||
|
Dinnertime:
|
|||
|
salad = 4
|
|||
|
bread = 2
|
|||
|
soup = 5
|
|||
|
dinner = salad + bread + soup
|
|||
|
DEBUG "Dinner = $",#dinner, "plus local tax.", CR
|
|||
|
</pre>
|
|||
|
<div class="Col2">
|
|||
|
<div class="MasterFoot">
|
|||
|
<p MadCap:conditions="BSEconditions.BSEWebHelp (Primary)-INCLUDE"><a href="../../HomeTopics/HomePage.htm">Go to Welcome page</a>
|
|||
|
</p>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<div class="Col2">
|
|||
|
<div class="MasterFoot">
|
|||
|
<p style="text-align: right;"><span class="ContactInfoProjectName">BASIC Stamp Help</span> <![CDATA[ ]]><span class="ContactInfoVersion#">Version 2.5.4</span> <![CDATA[ ]]></p>
|
|||
|
<p style="text-align: right;">Copyright © <span class="ContactInfoCompanyName">Parallax Inc.</span></p>
|
|||
|
<p style="text-align: right;"><span class="SystemShortDate">8/8/2012</span>
|
|||
|
</p>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<script type="text/javascript">/* <![CDATA[ */
|
|||
|
|
|||
|
var _gaq = _gaq || [];
|
|||
|
_gaq.push(['_setAccount', 'UA-285614-1']);
|
|||
|
_gaq.push(['_trackPageview']);
|
|||
|
|
|||
|
(function() {
|
|||
|
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
|||
|
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
|||
|
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
|||
|
})();
|
|||
|
|
|||
|
/* ]]> */</script>
|
|||
|
<script type="text/javascript" src="../../SkinSupport/MadCapBodyEnd.js">
|
|||
|
</script>
|
|||
|
</body>
|
|||
|
</html>
|