#include "MusimatTutorial.h"
MusimatTutorialSection(B0109) {
Print("*** B.1.9 Assignment ***");
/*****************************************************************************

B.1.9 Assignment

We can assign the value of an expression to a variable using the assignment operator =. For example,

lhs = rhs;

assigns the expression rhs to lhs. The object on the right-hand side of the = sign (i.e., rhs) can 
be any expression. The object on the left-hand side (i.e., lhs) must be a variable name, with one 
exception. For example, the statement

s = 3 + 5;

sets the value of variable s to 8.

The left-hand side of an assignment can also indicate that a certain element of a list is to receive 
the value on the right-hand side. For example,
*****************************************************************************/

IntegerList iL(0, 1, 2, 3);

iL[2] = 10;

/*****************************************************************************
replaces the third element with 10, causing the list to become

{0, 1, 10, 3}

Note that lists are indexed starting at 0. So writing
*****************************************************************************/

iL[0] = 55;

/*****************************************************************************
causes the list to be {55, 1, 10, 3} which we can see by printing it:
*****************************************************************************/

Print( iL );

}}

//////////////////////////////////////////////////////////////////////////////////////////////////////
/* $Revision: 1.2 $ $Date: 2006/09/05 06:32:25 $ $Author: dgl $ $Name:  $ $Id: B0109.cpp,v 1.2 2006/09/05 06:32:25 dgl Exp $ */
// The Musimat Tutorial © 2006 Gareth Loy
// Derived from Chapter 9 and Appendix B of "Musimathics Vol. 1" © 2006 Gareth Loy 
// and published exclusively by The MIT Press.
// This program is released WITHOUT ANY WARRANTY; without even the implied 
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
// For information on usage and redistribution, and for a DISCLAIMER OF ALL
// WARRANTIES, see the file, "LICENSE.txt," in this distribution.
// "Musimathics" is available here:	http://mitpress.mit.edu/catalog/item/default.asp?ttype=2&tid=10916
// Gareth Loy's Musimathics website:	http://www.musimathics.com/
// The Musimat website:			http://www.musimat.com/
// This program is released under the terms of the GNU General Public License
// available here:			http://www.gnu.org/licenses/gpl.txt

