UNPKG

epubjs

Version:

Render ePub documents in the browser, across many devices

121 lines (115 loc) 5.2 kB
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <meta charset="utf-8"/> <title>Getting Started with Processing</title> <script type="text/javascript"> if(!window.atlasplugins) window.atlasplugins = {} atlasplugins.codeMirrorSettings = { theme: "3024-day" } </script> <link href="http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700" rel="stylesheet" type="text/css"> </link> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"> </script> <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> </script> <link rel="stylesheet" type="text/css" href="theme/html/html.css"/> <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/4.4.0/codemirror.min.css"/> <link rel="stylesheet" type="text/css" href="https://d2uogd9jz9k9zm.cloudfront.net/processingjs-0.0.3.css"/> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js" type="text/javascript"> </script> <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/4.4.0/codemirror.min.js" type="text/javascript"> </script> <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/4.5.0/mode/clike/clike.min.js" type="text/javascript"> </script> <script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.6.0/underscore-min.js" type="text/javascript"> </script> <script src="https://cdnjs.cloudflare.com/ajax/libs/processing.js/1.4.8/processing.min.js" type="text/javascript"> </script> <script src="https://d2uogd9jz9k9zm.cloudfront.net/processingjs-0.0.3.min.js" type="text/javascript"> </script> <script type="text/javascript"> $(function() { // Make all non runnable examples readonly codemirrors $('pre:not(*[data-executable], .CodeMirror pre)').each(function(i, el) { var textArea = $('<textarea>' + el.innerHTML + '</textarea>') $(el).replaceWith(textArea); var editor = CodeMirror.fromTextArea(textArea[0], { mode: "text/x-java", theme: "3024-day", readOnly: true, viewportMargin: 0 }); }); }); </script> <style type="text/css"> /* This needs to come last to set auto height, and html.css is always included first */ .CodeMirror { height: auto; font-size: 14px; padding: 15px; border-radius: 5px; } .CodeMirror-scroll { overflow-y: hidden; overflow-x: auto; height: auto; } </style> <script type="text/javascript" src="theme/html/epub.js"> </script> <script type="text/javascript" src="theme/html/reader.js"> </script> </head> <body data-type="book" id="viewer"> <section data-type="appendix" data-pdf-bookmark="Appendix B. Data Types" id="data_types"> <h1>Data Types</h1> <p>There are different categories of data. For instance, think about the data on an ID card. The card has numbers to store weight, height, date of birth, street address, and postal code. It has words to store a person’s name and city. There’s also image data (a photo) and often an organ donor choice, which is a yes/no decision. In Processing, we have different data types to store each kind of data. Each of the following types is explained in more detail elsewhere in the book, but this is a summary.</p> <table> <thead> <tr> <th>Name</th> <th>Description</th> <th>Range of values</th> </tr> </thead> <tbody> <tr> <td><p><em>int</em></p></td> <td><p>Integers (whole numbers)</p></td> <td><p>−2,147,483,648 to 2,147,483,647</p></td> </tr> <tr> <td><p><em>float</em></p></td> <td><p>Floating-point values</p></td> <td><p>−3.40282347E+38 to 3.40282347E+38</p></td> </tr> <tr> <td><p><em>boolean</em></p></td> <td><p>Logical value</p></td> <td><p>true or false</p></td> </tr> <tr> <td><p><em>char</em></p></td> <td><p>Single character</p></td> <td><p>A–z, 0–9, and symbols</p></td> </tr> <tr> <td><p><em>String</em></p></td> <td><p>Sequence of characters</p></td> <td><p>Any letter, word, sentence, and so on</p></td> </tr> <tr> <td><p><em>PImage</em></p></td> <td><p>PNG, JPG, or GIF image</p></td> <td><p>N/A</p></td> </tr> <tr> <td><p><em>PFont</em></p></td> <td><p>VLW font; use the Create Font tool to make</p></td> <td><p>N/A</p></td> </tr> <tr> <td><p><em>PShape</em></p></td> <td><p>SVG file</p></td> <td><p>N/A</p></td> </tr> </tbody> </table> <p>As a guideline, a <em>float</em> number has about four digits of accuracy after the decimal point. If you’re counting or taking small steps, you should use an <em>int</em> value to take the steps, and then perhaps scale it by a <em>float</em> if necessary when putting it to use.</p> <p>There are more data types than those mentioned here, but these are the most useful for the work typically made with Processing. In fact, as mentioned in <a data-type="xref" href="ch09.html#objects">Chapter 9</a>, there are infinite types of data, because every new class is a different data type.</p> </section> </body> </html>