Functions

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

#include "MusimatTutorial.h"

Go to the source code of this file.

Functions

 MusimatTutorialSection (B0105)

Function Documentation

MusimatTutorialSection ( B0105   )

Definition at line 2 of file B0105.cpp.

                              {
        Print("*** B.1.5 Variables ***");
        /*****************************************************************************
         
         B.1.5 Variables
         
         We've seen variables already, but here's a proper introduction to them.
         
         Variables are named places to store data. Names are indicated by one or more upper- or lower-case 
         letters, like Q, n, or fred. Alphabetic case is significant, so fred  denotes a different variable than 
         does Fred. Numbers can also be used in variable names (for example,  Fred33), but the first letter 
         of a variable name may not be a number.
         
         Since they physically embody data, variables occupy space and time. Variables flow into 
         existence when they are defined, and generally hold their value until the end of the program 
         unless additional steps are taken to change their value or to restrict their existence to a certain 
         region of the program.
         
         Here are some examples of Integer and Real variables.  The examples also show the initialization
         of the variables with initial constant values using the assignment operator '='.
         
         *****************************************************************************/
        
        Integer a = 3;  // Define variable a and assign it an initial value of 3
        Real b = 3.14;  // Define variable b and assign it an initial value of 3.14
        Print("a=", a);
        Print("b=", b);
        
        // "Camel case" can make long variable names (slightly) easier to read
        Integer hereIsAFunnyVariableNameUsingCamelCase = 666;
        Print( hereIsAFunnyVariableNameUsingCamelCase );
        
}