Difference between revisions of "If statements"
From CodeStuff
(Created page with "You can use if statements to optionally run a piece of code. The if statement takes the form if (condition) { actions; } <edcode> if (true) { print("this text will al...") |
(No difference)
|
Revision as of 20:53, 19 June 2014
You can use if statements to optionally run a piece of code.
The if statement takes the form
if (condition) {
actions;
}
You can optionally provide code to be run when the condition is not true with else.
if (condition) {
things to do when the condition is true
} else {
otherwise do the things here
}
In the example Below, the circle is filled when the mouse pointer is inside it.