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
ch02-getting-going.html [2017/08/19 23:27]
mithat [Program statements]
ch02-getting-going.html [2017/08/20 18:35] (current)
mithat [The console]
Line 21: Line 21:
 </​file>​ </​file>​
  
-This is an example of a program written in what Processing calls its Basic Mode. In Basic Mode, the program'​s execution will begin at the first statement in the source code file. It will then continue statement-by-statement until it reaches the end of the file.+This is an example of a program written in what Processing calls its //Basic Mode//. In Basic Mode, the program'​s execution will begin at the first statement in the source code file. It will then continue statement-by-statement until it reaches the end of the file.
  
 Here's a program with two statements: Here's a program with two statements:
Line 34: Line 34:
 === Processing with an entry point === === Processing with an entry point ===
  
-Processing will automatically switch to Continuous Mode when you define at least one function in your program. (This is why you are not allowed to define functions in Basic Mode.) In Continuous Mode, Processing will look for a definition of a function called **''​%%setup%%''​**,​ and it will use this function as the point where the programs ​execution begins. Below is the Continuous Mode equivalent of the Basic Mode example above.+Processing will automatically switch to //Continuous Mode// when you define at least one function in your program. (This is why you are not allowed to define functions in Basic Mode.) In Continuous Mode, Processing will look for a definition of a function called **''​%%setup%%''​**,​ and it will use this function as the point where the program'​s ​execution begins. Below is the Continuous Mode equivalent of the Basic Mode example above.
  
 <file java cranberries_continuous_mode.pde>​ <file java cranberries_continuous_mode.pde>​
Line 111: Line 111:
 There are three ways to write comments in Processing: the "​standard"​ 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 "​standard" ​comment ​===+=== "​standard" ​comments ​===
 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: 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:
  
Line 178: Line 178:
  
 === doc comment === === doc comment ===
-The doc comment is a special case of the multiline comment. It's short for "​documentation comment."​ Its rules and behavior are identical to the multiline comment with one important difference: There is a tool available to Java programs (the platform on which Processing is based) called ''​javadoc''​ that when applied to a source file will find all the doc comments and produce nicely formatted and pretty documentation.+The doc comment is a special case of the multiline comment. It's short for "​documentation comment."​ Its rules and behavior are identical to the multiline comment with one important difference: There is a tool available to Java programs (the platform on which Processing is based) called ''​javadoc''​ that when applied to a source file will find all the doc comments and produce nicely formatted and pretty documentation ​from them.
  
 To turn a mutiline comment into a doc comment, just add an additional ''​*''​ in the opening tag: To turn a mutiline comment into a doc comment, just add an additional ''​*''​ in the opening tag:
Line 201: Line 201:
 )) ))
  
-In Processing, there is a console built into the IDE that you can use however ​you want. It is the dark box toward the bottom of the window ​(Figure TODO)Thus, when you run a Processing program from the Processing IDE, you will be able to see and use the console without having to do any extra work.+There is a console built into the Processing ​IDE should ​you want to use it. It'​s ​the dark box toward the bottom of the window. ​If it ever becomes hiddenyou can activate it by clicking on the "​Console"​ tab. This means when you run a Processing program from the Processing IDE, you will be able to see and use the console without having to do any extra work.
  
 === Outputting text === === Outputting text ===
ch02-getting-going.html.1503185228.txt.gz · Last modified: 2017/08/19 23:27 by mithat