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