-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathassignment.html
More file actions
215 lines (215 loc) · 6.29 KB
/
assignment.html
File metadata and controls
215 lines (215 loc) · 6.29 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Data Type Pt. 1 | ViT Web Dev</title>
<link
href="https://fonts.googleapis.com/css2?family=Big+Shoulders+Inline+Text&family=Noto+Sans+JP&display=swap"
rel="stylesheet"
/>
<link rel="stylesheet" href="./index.css" />
</head>
<body>
<div class="stack" id="main">
<div><h1>Assignment, Operators, & Comparisons</h1></div>
<div>
<div>
<h3>Operators & Assignment</h3>
<h4>
We're going to cover both operators and assignments together to
reduce redundancy.
</h4>
<table class="offset">
<thead>
<tr>
<th>Operator/Assignments</th>
<th>Example</th>
<th>Evaluation</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>=</td>
<td>var x = 1</td>
<td>1</td>
<td>Assigns a value to a variable</td>
</tr>
<tr>
<td>+=</td>
<td>x += 5</td>
<td>6</td>
<td>
Base on the previous assignment, we add the current value with
the new value.
</td>
</tr>
<tr>
<td>-=</td>
<td>x -= 1</td>
<td>5</td>
<td>Subtracting previous assignment with the new value.</td>
</tr>
<tr>
<td>*=</td>
<td>x *= 10</td>
<td>50</td>
<td>Multiplying previous assignment with the new value.</td>
</tr>
<tr>
<td>/=</td>
<td>x /= 5</td>
<td>10</td>
<td>Dividing previous assignment with the new value.</td>
</tr>
</tbody>
</table>
<p>There are many others but these are the most common ones.</p>
<div class="codeBlock">
<p>// A list of other assignments:</p>
<ul>
<li>
%= // Remainder Assignment: assigns the remainder value after
evaluation
</li>
<li>**= // Exponential Assignment: assigns the exponential</li>
<li>
<<= // Left Shift Assignment: moves the specific bits to the
left and assigns
</li>
<li>
>>= // Right Shift Assignment: moves specific bits to the right
and assigns
</li>
<li>
>>>= // Unsigned Right Shift Assignment:moves specific
<b>amount</b> of bits to the right and assigns
</li>
<li>
&= // Bitwise AND assignment: compares and assigns like binary
representations
</li>
<li>
^= // Bitwise XOR assignment: compares and assigns unlike binary
representations
</li>
</ul>
</div>
</div>
<div>
<h3>Comparisons</h3>
<table class="offset">
<thead>
<tr>
<th>Operator</th>
<th>Description</th>
<th>Example</th>
<th>Evaluation</th>
</tr>
</thead>
<tbody>
<tr>
<td>==</td>
<td>equal to</td>
<td>8 == 8</td>
<td>true</td>
</tr>
<tr>
<td></td>
<td></td>
<td>5 == 8</td>
<td>false</td>
</tr>
<tr>
<td></td>
<td></td>
<td>5 == "5"</td>
<td>true</td>
</tr>
<tr>
<td>===</td>
<td>equal value and equal type</td>
<td>5 === 5</td>
<td>true</td>
</tr>
<tr>
<td></td>
<td></td>
<td>5 === "5"</td>
<td>false</td>
</tr>
<tr>
<td>!=</td>
<td>not equal</td>
<td>10 != 10</td>
<td>false</td>
</tr>
<tr>
<td>!=</td>
<td>not equal</td>
<td>10 != "10"</td>
<td>false</td>
</tr>
<tr>
<td></td>
<td></td>
<td>11 != 10</td>
<td>true</td>
</tr>
<tr>
<td>!==</td>
<td>not equal value or equal type</td>
<td>10 !== 10</td>
<td>false</td>
</tr>
<tr>
<td></td>
<td></td>
<td>10 !== "10"</td>
<td>true</td>
</tr>
<tr>
<td></td>
<td></td>
<td>10 !== 8</td>
<td>true</td>
</tr>
<tr>
<td>></td>
<td>greater than</td>
<td>11 > 10</td>
<td>true</td>
</tr>
<tr>
<td><</td>
<td>less than</td>
<td>10 < 11</td>
<td>true</td>
</tr>
<tr>
<td>>=</td>
<td>greater than or equal to</td>
<td>11 >= 10</td>
<td>true</td>
</tr>
<tr>
<td><=</td>
<td>less than or equal to</td>
<td>5 <= 5</td>
<td>true</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div id="footer">
<div></div>
<div class="textAlign">
<button onclick="window.location.href='./index.html'">Home</button>
</div>
<div></div>
</div>
</body>
</html>