<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../style.css">
<title>
Gambas Documentation - How to Use Public Arrays
</title>
</head>
<body>
<table class="none" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr><td align="left">
<font size="-1">
<a href="../../help%3Fen"><img class="flag" alt="Home" border="0" src="../../img/lang/en.png" align="center"></a>&nbsp;&nbsp;
<a href="../howto%3Fen">Up</a>&nbsp;&nbsp;
<a href="translate/%3Atranslate.png%3Fen">Previous</a>&nbsp;&nbsp;
<a href="windows%3Fen">Next</a>&nbsp;&nbsp;
</td></tr></table>
<div class="notab">
<h1>
How to Use Public Arrays
</h1>
<h4>Gambas Classical Public Arrays</h4>
<p>
The <a href="../def/gambas%3Fen">Gambas</a> concept for <a href="../lang/public%3Fen">PUBLIC</a> Arrays is, to use <a href="../comp/gb/integer[]%3Fen">Integer[]</a> :
<p>
<div class="gray"><font color="white" size="-2"><b>Example</b></font></div>
<pre class="example">PUBLIC iDynamic AS Integer[]

PUBLIC SUB Button6_Click()
DIM iVal AS Integer
DIM fStarttime AS Float

iDynamic = NEW Integer[](1000)
FOR iVal = 0 TO 999
  iDynamic[iVal] = iVal
NEXT
PRINT &quot;fill iDynamic &quot;; Timer - fStarttime
END

PUBLIC SUB Button7_Click()
DIM iVal AS Integer
DIM iSum AS Integer
DIM fStarttime AS Float

fStarttime = Timer
isum = 0
FOR iVal = 0 TO 999
  iSum = iSum + iDynamic[iVal]
NEXT
PRINT &quot;sum iDynamic &quot;; Timer - fStarttime
END</pre>

</div>
<hr>
</body>
</html>

