User Tools

Site Tools


ch02-getting-going.html

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
ch02-getting-going.html [2017/08/19 21:40]
mithat [Comments]
ch02-getting-going.html [2017/08/19 23:27]
mithat [Program statements]
Line 91: Line 91:
 If a statement is the programming equivalent of a sentence, why are semicolons used to mark the end of statements rather than periods? If a statement is the programming equivalent of a sentence, why are semicolons used to mark the end of statements rather than periods?
  
-The biggest reason for this is that the language ​on which Processing is based, Java, uses semicolons to mark the end of statements. But why does Java do this? Because the language on which a lot of Java syntax is based, C++, also uses semicolons. Why does C++ do this? Because ... , you get the idea.+The biggest reason for this is that the language ​of the platform in which Processing is built, Java, uses semicolons to mark the end of statements. But why does Java do this? Because the language on which a lot of Java syntax is based, C++, also uses semicolons. Why does C++ do this? Because ... , you get the idea.
  
 The language ALGOL, whose development began in the late 1950'​s,​ may have been the first language to use the semicolon as the statement terminator. While the semicolon is widely used for this purpose, you should note that this is by no means universal. The language ALGOL, whose development began in the late 1950'​s,​ may have been the first language to use the semicolon as the statement terminator. While the semicolon is widely used for this purpose, you should note that this is by no means universal.
Line 109: Line 109:
 However, there will be times when you will want to include text in your code just to help human readers. For example, you might want to include some information about who authored the program, when it was written, licensing information,​ etc. That is what **comments** are for. However, there will be times when you will want to include text in your code just to help human readers. For example, you might want to include some information about who authored the program, when it was written, licensing information,​ etc. That is what **comments** are for.
  
-There are three ways to write comments in Processing: the plain old comment, the multi line comment, and the doc comment. +There are three ways to write comments in Processing: the "​standard" ​comment, the multi line comment, and the doc comment.
- +
-=== the plain old comment === +
-The most common syntax for creating comments in Processing is to use a double forward slash: ''​%%//​%%''​. Anything that comes after a double slash up to the end of the line is considered a comment by the Processing compiler. Here a version of the ''​cranberries2.pde''​ program with some added some comments to identify the author and other information and explain some of the code:+
  
 +=== the "​standard"​ comment ===
 +The most common syntax for creating comments in Processing is to use a double forward slash: ''​%%//​%%''​. Anything that comes after a double slash up to the end of the line is a comment and will be ignored by the Processing compiler. Here a version of the ''​cranberries2.pde''​ program with some added some comments to identify the author and other information and explain some of the code:
  
 <file java cranberries2-with-comments.pde>​ <file java cranberries2-with-comments.pde>​
ch02-getting-going.html.txt · Last modified: 2017/08/20 18:35 by mithat