<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<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>
<table class="none" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr><td align="left">
<font size="-1">
<a href="../../help+en"><img class="flag" alt="Home" border="0" src="../../img/lang/en.png" align="center"></a>&nbsp;
<a href="../howto+en">Up</a>&nbsp;
<a href="translate/+translate.png+en">Previous</a>&nbsp;
<a href="windows+en">Next</a>&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+en">Gambas</a> concept for <a href="../lang/public+en">PUBLIC</a> Arrays is, to use <a href="../comp/gb/integer[]+en">Integer[]</a> :
<p>
<div class="gray"><font 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>
</body>
</html>

