User Tools

Site Tools


control-constructs

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
control-constructs [2015/12/17 04:11]
barryfp
control-constructs [2017/06/23 09:42] (current)
barryfp
Line 3: Line 3:
 If statements work exactly as in C or Java and can use the && and || operators to indicate logical and/or. You can also use ''​else if''​ and ''​else''​ blocks as in these languages. If statements work exactly as in C or Java and can use the && and || operators to indicate logical and/or. You can also use ''​else if''​ and ''​else''​ blocks as in these languages.
  
-<​code ​dana>+<​code ​d>
 if (a) if (a)
    {    {
Line 12: Line 12:
 While loops allow you to loop through a section of logic many times based on some boolean condition, specified at the top of the loop. While loops allow you to loop through a section of logic many times based on some boolean condition, specified at the top of the loop.
  
-<​code ​dana>+<​code ​d>
 while (a) while (a)
    {    {
Line 23: Line 23:
 For loops allow you to specify an initial variable status, a condition, and a modification to that variable each time around the loop: For loops allow you to specify an initial variable status, a condition, and a modification to that variable each time around the loop:
  
-<​code ​dana>+<​code ​d>
 for (int i = 0; i < 10; i++) for (int i = 0; i < 10; i++)
    {    {
Line 34: Line 34:
 Finally, the special ''​break''​ statement can be used inside any kind of loop construct to break out of the loop when some other condition is encountered,​ for example: Finally, the special ''​break''​ statement can be used inside any kind of loop construct to break out of the loop when some other condition is encountered,​ for example:
  
-<​code ​dana>+<​code ​d>
 for (int i = 0; i < 10; i++) for (int i = 0; i < 10; i++)
    {    {
control-constructs.txt ยท Last modified: 2017/06/23 09:42 by barryfp