|
6 | 6 |
|
7 | 7 | /** |
8 | 8 | * Creates and names a new variable. A variable is a container for a value. |
| 9 | + * |
9 | 10 | * Variables that are declared with <a href="#/p5/let">let</a> will have block-scope. |
10 | 11 | * This means that the variable only exists within the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/block"> |
11 | 12 | * block</a> that it is created within. |
|
31 | 32 | * Creates and names a new constant. Like a variable created with <a href="#/p5/let">let</a>, a constant |
32 | 33 | * that is created with <a href="#/p5/const">const</a> is a container for a value, |
33 | 34 | * however constants cannot be changed once they are declared. |
| 35 | + * |
34 | 36 | * Constants have block-scope. This means that the constant only exists within |
35 | 37 | * the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/block"> |
36 | 38 | * block</a> that it is created within. A constant cannot be redeclared within a scope in which it |
|
163 | 165 |
|
164 | 166 | /** |
165 | 167 | * The <a href="#/p5/if-else">if-else</a> statement helps control the flow of your code. |
166 | | - * A condition is placed between the parenthesis following 'if'. |
167 | | - * When that condition evalues to <a href="https://developer.mozilla.org/en-US/docs/Glossary/truthy">truthy</a>, |
| 168 | + * |
| 169 | + * A condition is placed between the parenthesis following 'if', |
| 170 | + * when that condition evalues to <a href="https://developer.mozilla.org/en-US/docs/Glossary/truthy">truthy</a>, |
168 | 171 | * the code between the following curly braces is run. |
169 | 172 | * Alternatively, when the condition evaluates to <a href="https://developer.mozilla.org/en-US/docs/Glossary/Falsy">falsy</a>, |
170 | 173 | * the code between the curly braces that follow 'else' is run instead. |
|
194 | 197 | /** |
195 | 198 | * Creates and names a <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Functions">function</a>. |
196 | 199 | * A <a href="#/p5/function">function</a> is a set of statements that perform a task. |
| 200 | + * |
197 | 201 | * Optionally, functions can have parameters. <a href="https://developer.mozilla.org/en-US/docs/Glossary/Parameter">Parameters</a> |
198 | 202 | * are variables that are scoped to the function, that can be assigned a value when calling the function. |
199 | 203 | * |
|
378 | 382 | /** |
379 | 383 | * <a href="#/p5/while">while</a> creates a loop that is useful for executing one section of code multiple times. |
380 | 384 | * |
381 | | - * With a 'while loop', the code inside of the loop body (in between the curly braces) is run repeatedly until the test condition |
| 385 | + * With a 'while loop', the code inside of the loop body (between the curly braces) is run repeatedly until the test condition |
382 | 386 | * (inside of the parenthesis) evaluates to false. Unlike a <a href="#/p5/for">for</a> loop, the condition is tested before executing the code body with <a href="#/p5/while">while</a>, |
383 | | - * so if the condition is initially false the loop body, or statement will never execute. |
| 387 | + * so if the condition is initially false the loop body, or statement, will never execute. |
384 | 388 | * |
385 | 389 | * As with any loop, it is important to ensure that the loop can 'exit', or that |
386 | 390 | * the test condition will eventually evaluate to false. This is to keep your loop from trying to run an infinite amount of times, |
|
0 commit comments