User Tools

Site Tools


programming_fundamentals_with_processing:ch02-getting-going.html

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
programming_fundamentals_with_processing:ch02-getting-going.html [2017/07/26 16:57] mithatprogramming_fundamentals_with_processing:ch02-getting-going.html [2017/07/26 17:44] (current) – [The console] mithat
Line 129: Line 129:
 Sending text messages to the console can be accomplished with two predefined Processing functions: ''%%print%%'' and ''%%println%%''. Here is an example of a Processing program that uses ''%%println%%'' to output a message to the console: Sending text messages to the console can be accomplished with two predefined Processing functions: ''%%print%%'' and ''%%println%%''. Here is an example of a Processing program that uses ''%%println%%'' to output a message to the console:
  
-**program ''%%cranberries.pde%%'':** +<file java cranberries.pde>
- +
-<code java>+
 void setup() { void setup() {
   println("Cranberries are high in antioxidants.");   println("Cranberries are high in antioxidants.");
 } }
-</code>+</file> 
 The above code consists of a definition of the ''%%setup%%'' function in which there is a **call** to or **invocation** of the ''%%println%%'' function. The program will produce the following console output when you run it: The above code consists of a definition of the ''%%setup%%'' function in which there is a **call** to or **invocation** of the ''%%println%%'' function. The program will produce the following console output when you run it:
  
Line 141: Line 140:
 Cranberries are high in antioxidants. Cranberries are high in antioxidants.
 </code> </code>
 +
 Notice the double quotation marks around the text. These are important. They tell ''%%println%%'' that everything between them is a string of text characters that should be treated as a unit. Notice the double quotation marks around the text. These are important. They tell ''%%println%%'' that everything between them is a string of text characters that should be treated as a unit.
  
Line 157: Line 157:
 } }
 </code> </code>
 +
 produces the following console output: produces the following console output:
  
Line 162: Line 163:
 Cranberries are high in antioxidants. Cranberries are high in antioxidants.
 </code> </code>
 +
 Using ''%%println%%'': Using ''%%println%%'':
  
Line 172: Line 174:
 } }
 </code> </code>
-will outputs:+ 
 +will output:
  
 <code> <code>
Line 180: Line 183:
 antioxidants. antioxidants.
 </code> </code>
 +
 === Outputting numbers and calculations === === Outputting numbers and calculations ===
  
Line 215: Line 219:
 </code> </code>
  
----- +<WRAP center round box 80%>
 === Geek break: What about input? === === Geek break: What about input? ===
  
Line 224: Line 227:
  
 Because text-based input is as involved as it is in Processing, we will avoid it in this text. We will, however, work with some of the interaction features that Processing makes very easy when we cover //event handling//. Because text-based input is as involved as it is in Processing, we will avoid it in this text. We will, however, work with some of the interaction features that Processing makes very easy when we cover //event handling//.
 +</WRAP>
  
  
----- 
  
 ==== The canvas ==== ==== The canvas ====
programming_fundamentals_with_processing/ch02-getting-going.html.1501088233.txt.gz · Last modified: 2017/07/26 16:57 by mithat

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki