CS Discoveries | If Statements https://studio.code.org/docs/csd/if_statements/index.html
Understanding Program FlowPrograms are said to have a „flow of execution“. You start by executing a line of code, then the next, then the next, and so on.
Understanding Program FlowPrograms are said to have a „flow of execution“. You start by executing a line of code, then the next, then the next, and so on.
Because the Creative Commons provides such a simple way to know what media you can and can’t use, a lot of search engines have integrated Creative Commons filtering to ensure they only give you results you can use. When using a search engine that supports Creative Commons filtering, you usually just need to check a few boxes to make sure the media you find are licensed for your use.
The onEvent() block is used to set up event handlers that can watch for certain events to occur in your app, such as clicking on a button, selecting an item from a dropdown, or moving the mouse. The Circuit Playground has a similar block called onBoardEvent() to watch for events that occur on the board. Similar to onEvent(), you need to specify what the handler should be watching, what event to watch for, and how to respond to that event.
How If-Else Statements work
Design Mode makes it really easy to lay out the User Interface for your app, but we’ll need to dive into Code Mode to make it actually respond to users.
The Circuit Playground is a simple single board computer with many built in Inputs and Outputs for us to explore. Before digging too deep however, let’s start with the basics.
In Unit 4 you saw that you can lay out an app in App Lab using elements in Design Mode. This drag-and-drop approach is quick and easy, but you can only create a page like this before you run the program. Sometimes you want the elements of your app to change while it’s running, and to do that we’ll need to use code.
When using sensors for input it’s more common to continually collect input and watch for changes than to only check when the user clicks a button or otherwise interacts. To allow for this kind of behavior, the sensors have some special events that get run continually.
It’s common to want to repeat a set of commands a particular number of times. The for loop was created to wrap all of those components related to counting loops into a single line of code.
A sprite is the name we give to a collection of values in Game Lab that represents a character in a story, animation, or game. A sprite can be stored in a variable with a label, but unlike values you’ve stored in variables before, such as numbers, a sprite lets you store many related values all under the same label