• Main Page
  • Files
  • File List
  • File Members

/Users/garethloy/Musimathics/Musimat1.2/MusimatTutorial/B0105.cpp

Go to the documentation of this file.
00001 #include "MusimatTutorial.h"
00002 MusimatTutorialSection(B0105) {
00003         Print("*** B.1.5 Variables ***");
00004         /*****************************************************************************
00005          
00006          B.1.5 Variables
00007          
00008          We've seen variables already, but here's a proper introduction to them.
00009          
00010          Variables are named places to store data. Names are indicated by one or more upper- or lower-case 
00011          letters, like Q, n, or fred. Alphabetic case is significant, so fred  denotes a different variable than 
00012          does Fred. Numbers can also be used in variable names (for example,  Fred33), but the first letter 
00013          of a variable name may not be a number.
00014          
00015          Since they physically embody data, variables occupy space and time. Variables flow into 
00016          existence when they are defined, and generally hold their value until the end of the program 
00017          unless additional steps are taken to change their value or to restrict their existence to a certain 
00018          region of the program.
00019          
00020          Here are some examples of Integer and Real variables.  The examples also show the initialization
00021          of the variables with initial constant values using the assignment operator '='.
00022          
00023          *****************************************************************************/
00024         
00025         Integer a = 3;  // Define variable a and assign it an initial value of 3
00026         Real b = 3.14;  // Define variable b and assign it an initial value of 3.14
00027         Print("a=", a);
00028         Print("b=", b);
00029         
00030         // "Camel case" can make long variable names (slightly) easier to read
00031         Integer hereIsAFunnyVariableNameUsingCamelCase = 666;
00032         Print( hereIsAFunnyVariableNameUsingCamelCase );
00033         
00034 }
00035 
00037 /* $Revision: 1.2 $ $Date: 2006/09/05 06:32:24 $ $Author: dgl $ $Name:  $ $Id: B0105.cpp,v 1.2 2006/09/05 06:32:24 dgl Exp $ */
00038 // The Musimat Tutorial � 2006 Gareth Loy
00039 // Derived from Chapter 9 and Appendix B of "Musimathics Vol. 1" � 2006 Gareth Loy 
00040 // and published exclusively by The MIT Press.
00041 // This program is released WITHOUT ANY WARRANTY; without even the implied 
00042 // warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
00043 // For information on usage and redistribution, and for a DISCLAIMER OF ALL
00044 // WARRANTIES, see the file, "LICENSE.txt," in this distribution.
00045 // "Musimathics" is available here:     http://mitpress.mit.edu/catalog/item/default.asp?ttype=2&tid=10916
00046 // Gareth Loy's Musimathics website:    http://www.musimathics.com/
00047 // The Musimat website:                 http://www.musimat.com/
00048 // This program is released under the terms of the GNU General Public License
00049 // available here:                      http://www.gnu.org/licenses/gpl.txt
00050 

Generated on Fri Nov 26 2010 16:18:25 for Musimat Tutorial by  doxygen 1.7.2