1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
<!DOCTYPE html>
<html lang="en" dir="ltr" class="no-js">
<head>
<meta charset="utf-8" />
<title>en:variables [BASIC 256 - Language Documentation]</title>
<link rel="stylesheet" type="text/css" href="lib/exe/cssc171c1dfe8519125bb40a349172b001a.css"/>
</head>
<body>
<div id="dokuwiki__site"><div id="dokuwiki__top" class="site dokuwiki mode_show tpl_dokuwiki ">
<div id="dokuwiki__header"><div class="pad group">
<div class="headings group">
<h1><a href="start.html" accesskey="h" title="[H]"><img src="lib/tpl/dokuwiki/images/logo.png" width="64" height="64" alt="" /> <span>BASIC 256 - Language Documentation</span></a></h1>
</div>
</div>
<div class="breadcrumbs">
<div class="youarehere"><span class="bchead">You are here: </span><span class="home"><bdi><a href="start.html" class="wikilink1" title="start">start</a></bdi></span> » <bdi><a href="en_start.html" class="wikilink1" title="en:start">en</a></bdi> » <bdi><span class="curid"><a href="en_variables.html" class="wikilink1" title="en:variables">variables</a></span></bdi></div>
</div>
<hr class="a11y" />
</div></div>
<div class="wrapper group">
<div id="dokuwiki__content"><div class="pad group">
<div class="pageId"><span>en:variables</span></div>
<div class="page group">
<h2 class="sectionedit1" id="variables">Variables</h2>
<div class="level2">
<p>
Variables that hold numeric values must begin with a letter, and may consist of any number of alpha-numeric characters. They are case sensitive. They may be used interchangeably with numeric constants.<br/>
<br/>
Variables that hold string values follow the same rules as numeric variables, but must end with a dollar sign ($). They may be used interchangeably with string constants.
<br/>
When you assign a numeric value to a string variable or add a numeric value to a string (concatenate) the number will be automatically converted to a string before the operation is completed. A string value may not be assigned directly to a numeric variable or array element without manually converting it's type using the <a href="en_int.html" class="wikilink1" title="en:int">Int</a> or <a href="en_float.html" class="wikilink1" title="en:float">Float</a> functions.
<br/>
</p>
<div class="table sectionedit2"><table class="inline">
<tr class="row0">
<th class="col0" colspan="4">Variable Assignment</th>
</tr>
<tr class="row1">
<th class="col0">Operator</th><th class="col1">Name</th><th class="col2">Example</th><th class="col3">Comments</th>
</tr>
<tr class="row2">
<td class="col0">=</td><td class="col1">Assign a Number to a Numeric Variable</td><td class="col2">a = 9</td><td class="col3"> </td>
</tr>
<tr class="row3">
<td class="col0">=</td><td class="col1">Assign a String to a String Variable</td><td class="col2">z$ = “Hola.”</td><td class="col3"> </td>
</tr>
<tr class="row4">
<td class="col0">=</td><td class="col1">Assign a Number to a String Variable</td><td class="col2">q$ = 9.9</td><td class="col3"> </td>
</tr>
<tr class="row5">
<td class="col0">+=</td><td class="col1">Add to Numeric Variable</td><td class="col2">a += 7</td><td class="col3">Same as a = a + 7 <sup>1</sup></td>
</tr>
<tr class="row6">
<td class="col0">+=</td><td class="col1">Concatenate to String Variable</td><td class="col2">f$ += ”.”</td><td class="col3">Same as f$ = f$ + ”.” <sup>1</sup></td>
</tr>
<tr class="row7">
<td class="col0">-=</td><td class="col1">Subtract from Numeric Variable</td><td class="col2">a -= 9</td><td class="col3">Same as a = a - 9 <sup>1</sup></td>
</tr>
<tr class="row8">
<td class="col0">*=</td><td class="col1">Multiply Numeric Variable</td><td class="col2">a *= 2</td><td class="col3">Same as a = a * 2 <sup>1</sup></td>
</tr>
<tr class="row9">
<td class="col0">/=</td><td class="col1">Divide Numeric Variable</td><td class="col2">a /= 8</td><td class="col3">Same as a = a / 8 <sup>1</sup></td>
</tr>
</table></div>
<p>
<br/>
<sup>1</sup> added with version 0.9.9.10
</p>
</div>
</div>
<div class="docInfo"><bdi>en/variables.txt</bdi> · Last modified: 2012/11/01 09:10 by <bdi>admin</bdi></div>
</div></div>
<hr class="a11y" />
</div>
<div id="dokuwiki__footer"><div class="pad">
<div class="license">Except where otherwise noted, content on this wiki is licensed under the following license: <bdi><a href="http://creativecommons.org/licenses/by-sa/3.0/" rel="license" class="urlextern">CC Attribution-Share Alike 3.0 Unported</a></bdi></div>
</div></div>
</div></div>
<div id="screen__mode" class="no"></div>
</body>
</html>
|