#include "MusimatTutorial.h"Go to the source code of this file.
Functions | |
| MusimatTutorialSection (B0114) | |
| MusimatTutorialSection | ( | B0114 | ) |
Definition at line 2 of file B0114.cpp.
00002 { 00003 Print("*** B.1.14 Accessing List Elements ***"); 00004 /***************************************************************************** 00005 00006 B.1.14 Accessing List Elements 00007 00008 We can access an element of a list using the index operator []. Suppose we have the following 00009 declarations: 00010 *****************************************************************************/ 00011 00012 Integer w = 1, x = 2, y = 3, z = 4; 00013 IntegerList iL(w, x, y, z); 00014 00015 /***************************************************************************** 00016 Then the statement 00017 *****************************************************************************/ 00018 00019 Integer c = iL[0]; 00020 00021 /***************************************************************************** 00022 assigns c the same value as w (which is 1). The statement 00023 *****************************************************************************/ 00024 00025 c = iL[3]; 00026 00027 /***************************************************************************** 00028 assigns c the same value as z (which is 4). 00029 00030 The first element on a list is indexed by 0, and if a List has N elements, the last one is indexed 00031 by N - 1. 00032 00033 *****************************************************************************/ 00034 }}
1.4.7