-
Notifications
You must be signed in to change notification settings - Fork 482
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'staging' of github.com:code-dot-org/code-dot-org into s…
…taging
- Loading branch information
Showing
68 changed files
with
1,190 additions
and
267 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
dashboard/config/scripts/csd_gettext_vs_getnumber.external
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name 'CSD: getText vs getNumber' | ||
href 'path/to/html/in/asset/folder' | ||
markdown <<MARKDOWN | ||
# getText vs getNumber | ||
|
||
Computers store information in different ways. Two different ways a computer stores information are strings and numbers. | ||
|
||
`getNumber()` tries to get the value of whatever you are asking about as a number. | ||
|
||
`getText()` gets the value of whatever you are asking about as a string. Strings are often marked in your programs with `" "`. For example all the names of your IDs are strings. You can use `getText()` to retrieve a number but just know that it will be surrounded by `" "`. | ||
|
||
## Why does that matter? | ||
|
||
Usually it is fine to get everything as a string but when you want to do mathematical operations you need numbers not strings. When you try to add two strings together the computer thinks you want to combine the two strings together into one string. | ||
|
||
So when you say `"2" + "2"` the computer evaluates that to `"22"`. | ||
|
||
Where as when you say `2 + 2` (notice no `" "`) the computer evaluates that to `4`. | ||
MARKDOWN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name 'CSD: Variables Matching' | ||
question 'Program 3' | ||
answer '<img src="https://images.code.org/c999112a199aa2c9cf304a728ea6fda3-image-1463067995185.gif" style="width:150px">' | ||
question 'Program 2' | ||
answer '![](https://images.code.org/7c66a6cadb0d0a136492bbedac65ebb0-image-1463067992351.gif)' | ||
question 'Program 4' | ||
answer '![](https://images.code.org/7c46bbd6967456652171894454913042-image-1463067997744.gif)' | ||
question 'Program 1' | ||
answer '![](https://images.code.org/f53831a3dd4f122ba9a873640da67825-image-1463067988435.gif)' | ||
|
||
markdown <<MARKDOWN | ||
# Stop and Discuss | ||
|
||
This lesson was all about how to use **expressions** to be able to **use a variable like a counter**. To get more comfortable with how this works, try matching these 4 programs to their output. **Be prepared to justify your choices for each one**. | ||
|
||
**Program 1:** | ||
|
||
var position = 0; | ||
|
||
function draw(){ | ||
position = position + 1; | ||
background("white"); | ||
fill("red"); | ||
rect(position, 20, 50, 50); | ||
} | ||
|
||
**Program 2:** | ||
|
||
var position = 400; | ||
|
||
function draw(){ | ||
position = position - 1; | ||
background("white"); | ||
fill("red"); | ||
rect(20, position, 50, 50); | ||
} | ||
|
||
**Program 3:** | ||
|
||
var position = 0; | ||
|
||
function draw(){ | ||
position = position + 0.5; | ||
background("white"); | ||
fill("red"); | ||
rect(position, 20, 50, 50); | ||
} | ||
|
||
**Program 4:** | ||
|
||
var position = 400; | ||
|
||
function draw(){ | ||
position = position - 1; | ||
background("white"); | ||
fill("red"); | ||
rect(position, position, 50, 50); | ||
} | ||
MARKDOWN |
Oops, something went wrong.