File: en_operators.html

package info (click to toggle)
basic256 1.1.4.0-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 24,460 kB
  • sloc: cpp: 10,148; yacc: 3,023; java: 1,091; lex: 1,051; sh: 117; xml: 33; makefile: 15
file content (221 lines) | stat: -rw-r--r-- 10,857 bytes parent folder | download | duplicates (2)
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
<!DOCTYPE html>
<html lang="en" dir="ltr" class="no-js">
<head>
    <meta charset="utf-8" />
    <title>en:operators [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_operators.html" class="wikilink1" title="en:operators">operators</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:operators</span></div>
                <div class="page group">
<h2 class="sectionedit1" id="operators">Operators</h2>
<div class="level2">
<p>
The operators +, -, *, /, and ^ are used to perform addition, subtraction, multiplication, division, exponentiation of floating point and integer numbers. Valid operands are numeric constants and/or numeric variables.<br/>
<br/>
The operators %, \, &amp;, |, and ~ are used to calculate modulo, integer division, bitwise and, bitwise or, and bitwise negation (not) of integer expressions.  Floating point numbers will be coverted to an integer value before calculation.<br/>
<br/>
The = operator is used both for assignment to variables, and to test for equality.  The + operator may be used to perform concatenation of any combination of string constants and string variables.  The : operator can separate multiple statements on a single line.  The ; operator suppresses the new line that is printed from a PRINT statement.  The # operator is a shortcut for the <a href="en_rem.html" class="wikilink1" title="en:rem">Rem</a> statement, and is interchangeable with it.<br/>
<br/>
</p>
<div class="table sectionedit2"><table class="inline">
	<tr class="row0">
		<th class="col0" colspan="4">Arithmetic Operators</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">Addition</td><td class="col2">a + b</td><td class="col3">add two numric values</td>
	</tr>
	<tr class="row3">
		<td class="col0">-</td><td class="col1">Subtraction</td><td class="col2">a - b</td><td class="col3">subtract two numric values</td>
	</tr>
	<tr class="row4">
		<td class="col0">*</td><td class="col1">Multiplication</td><td class="col2">a * b</td><td class="col3"> </td>
	</tr>
	<tr class="row5">
		<td class="col0">/</td><td class="col1">Division</td><td class="col2">a / b</td><td class="col3">Returns a decimal number of times that b goes into a.</td>
	</tr>
	<tr class="row6">
		<td class="col0">\</td><td class="col1">Integer Division</td><td class="col2">a  b</td><td class="col3">Returns the number of whole times that b goes into a.</td>
	</tr>
	<tr class="row7">
		<td class="col0">%</td><td class="col1">Modulo</td><td class="col2">a % b</td><td class="col3">Returns the remainder of the integer division of a and b.</td>
	</tr>
	<tr class="row8">
		<td class="col0">++</td><td class="col1">Increment Prefix</td><td class="col2">++a</td><td class="col3">Increment (add one) the the variable and return the value after the increment. (may be applied ONLY to numeric variables or array elements)  <sup>1</sup></td>
	</tr>
	<tr class="row9">
		<td class="col0">++</td><td class="col1">Increment Suffix</td><td class="col2">a++</td><td class="col3">Return the value of the variable and then increment the variable by one for the next time it is accessed. (may be applied ONLY to numeric variables or array elements) <sup>1</sup></td>
	</tr>
	<tr class="row10">
		<td class="col0">–</td><td class="col1">Decrement Prefix</td><td class="col2">–a</td><td class="col3">Decrement (subtract one) the the variable and return the value after the decrement. (may be applied ONLY to numeric variables or array elements) <sup>1</sup></td>
	</tr>
	<tr class="row11">
		<td class="col0">–</td><td class="col1">Decrrement Suffix</td><td class="col2">a–</td><td class="col3">Return the value of the variable and then decrement the variable by one for the next time it is accessed. (may be applied ONLY to numeric variables or array elements) <sup>1</sup></td>
	</tr>
</table></div>
<p>
<br/>
</p>
<div class="table sectionedit3"><table class="inline">
	<tr class="row0">
		<th class="col0" colspan="4">Comparison Operators</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">Equal</td><td class="col2">a = b</td><td class="col3">Returns true of two values are equal</td>
	</tr>
	<tr class="row3">
		<td class="col0">&lt;</td><td class="col1">Less Than</td><td class="col2">a &lt; b</td><td class="col3"> </td>
	</tr>
	<tr class="row4">
		<td class="col0">&gt;</td><td class="col1">Greater Than</td><td class="col2">a &gt; b</td><td class="col3"> </td>
	</tr>
	<tr class="row5">
		<td class="col0">&lt;=</td><td class="col1">Less Than or Equal</td><td class="col2">a &lt;= b</td><td class="col3"> </td>
	</tr>
	<tr class="row6">
		<td class="col0">&gt;=</td><td class="col1">Greatet Than or Equal</td><td class="col2">a &gt;= b</td><td class="col3"> </td>
	</tr>
	<tr class="row7">
		<td class="col0">&lt;&gt;</td><td class="col1">Not Equal</td><td class="col2">a &lt;&gt; b</td><td class="col3"> </td>
	</tr>
</table></div>
<p>
<br/>
</p>
<div class="table sectionedit4"><table class="inline">
	<tr class="row0">
		<th class="col0" colspan="4">Logical Operators</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">NOT</td><td class="col1">Logical Negation</td><td class="col2">NOT a</td><td class="col3"> </td>
	</tr>
	<tr class="row3">
		<td class="col0">AND</td><td class="col1">Logical Conjunction</td><td class="col2">a AND b</td><td class="col3"> </td>
	</tr>
	<tr class="row4">
		<td class="col0">OR</td><td class="col1">Logical Disjunction</td><td class="col2">a OR b</td><td class="col3"> </td>
	</tr>
	<tr class="row5">
		<td class="col0">XOR</td><td class="col1">Logical Exclusive Disjunction</td><td class="col2">a XOR b</td><td class="col3"> </td>
	</tr>
</table></div>
<p>
<br/>
</p>
<div class="table sectionedit5"><table class="inline">
	<tr class="row0">
		<th class="col0" colspan="4">Bitwise Operators</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">Bitwide Negation</td><td class="col2">~a</td><td class="col3"> </td>
	</tr>
	<tr class="row3">
		<td class="col0">&amp;</td><td class="col1">Bitwise Conjunction</td><td class="col2">a &amp; b</td><td class="col3"> </td>
	</tr>
	<tr class="row4">
		<td class="col0">|</td><td class="col1">Bitwise Disjunction</td><td class="col2">a | b</td><td class="col3">Returns the bits of integer a or integer b.</td>
	</tr>
</table></div>
<p>
<br/>
</p>
<div class="table sectionedit6"><table class="inline">
	<tr class="row0">
		<th class="col0" colspan="4">String Operators</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">Concatenation</td><td class="col2">a$ + b$</td><td class="col3">Appends b$ to the end of a$.</td>
	</tr>
</table></div>
<p>
<br/>
</p>
<div class="table sectionedit7"><table class="inline">
	<tr class="row0">
		<th class="col0" colspan="3">Order of Operations</th>
	</tr>
	<tr class="row1">
		<th class="col0">Level</th><th class="col1">Operators</th><th class="col2">Category/Description</th>
	</tr>
	<tr class="row2">
		<td class="col0">1</td><td class="col1">( )</td><td class="col2">Grouping</td>
	</tr>
	<tr class="row3">
		<td class="col0">2</td><td class="col1">^</td><td class="col2">Exponent</td>
	</tr>
	<tr class="row4">
		<td class="col0">3</td><td class="col1">- ~</td><td class="col2">Unary Minus and Bitwise Negation (NOT)</td>
	</tr>
	<tr class="row5">
		<td class="col0">4</td><td class="col1">* / \</td><td class="col2">Multiplication and Division</td>
	</tr>
	<tr class="row6">
		<td class="col0">5</td><td class="col1">%</td><td class="col2">Integer Remainder (Mod)</td>
	</tr>
	<tr class="row7">
		<td class="col0">6</td><td class="col1">+ -</td><td class="col2">Addition, Concatenation, and Subtraction</td>
	</tr>
	<tr class="row8">
		<td class="col0">7</td><td class="col1">&amp; |</td><td class="col2">Bitwise And and Bitwise Or</td>
	</tr>
	<tr class="row9">
		<td class="col0">8</td><td class="col1">&lt; ⇐ &gt; &gt;= = &lt;&gt;</td><td class="col2">Comparison (Numeric and String)</td>
	</tr>
	<tr class="row10">
		<td class="col0">9</td><td class="col1">NOT</td><td class="col2">Unary Not</td>
	</tr>
	<tr class="row11">
		<td class="col0">10</td><td class="col1">AND</td><td class="col2">Logical And</td>
	</tr>
	<tr class="row12">
		<td class="col0">11</td><td class="col1">OR</td><td class="col2">Logical Or</td>
	</tr>
	<tr class="row13">
		<td class="col0">12</td><td class="col1">XOR</td><td class="col2">Logical Exclusive Or</td>
	</tr>
</table></div>
<p>
<br/>
<sup>1</sup> new with version 0.9.9.10
</p>
</div>
                                    </div>
                <div class="docInfo"><bdi>en/operators.txt</bdi> · Last modified: 2012/10/27 11:17 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>