blob: 4354a0293c19506d99508bba6ae22631b98b8130 [file] [log] [blame]
<html>
<body>
<h1>Vectors</h1>
<h2>Creating a non-empty vector and accessing it's elements</h2>
<p>In the following example, we create a vector variable that stores 3 integers representing coordinates. The definition of the initial value follows the classic pattern for all collection types.</p>
<p>To access an element contained within a vector you just need to write "vector_name[element_index]". This syntax is used in the routines that are defined to access to each one of the 3 coordinates.</p>
<p>To code is the following :</p>
<img src="images/vector001.png" width=1000, border="3">
<p>At the initialization, the 3 integer position variables will be given the values corresponding to the correct elements within the vector.</p>
<p>We can verify that this is the case by (for instance) generating and looking into the "phase1.fscn" file :</p>
<img src="images/vector002.png" width=1000, border="3">
<h2>Adding elements to a vector and modifying them</h2>
<p>In the following example, we create an empty vector variable that can carry integers. The syntax to append elements to the vector and to modify them is described.</p>
<p>To code is the following :</p>
<img src="images/vector003.png" width=1000, border="3">
<p>At the initialization, we push the "0" value into the vector. Then at each step of calculus we increment it (limited the exploration at 5 total steps).</p>
<p>We can verify that this is the case by (for instance) generating and looking into the "phase1.fscn" file :</p>
<img src="images/vector004.png" width=1000, border="3">
<h2>Removing elements from a vector</h2>
<p>NOT IMPLEMENTED FOR VECTORS</p>
<p></p>
<p></p>
</body>
</html>