Welcome to Pauls PureProject
 Home Online Reference Guide duplicated from http://cvs.purebasic.com  
 Online Resources
   · Reference

 Libraries
     2DDrawing
     Billboard
     Camera
     CDAudio
     Cipher
     Clipboard
     Console
     Database
     Date
     Desktop
     Engine3D
     Entity
     File
     FileSystem
     Font
     Gadget
     Help
     Image
     ImagePlugin
     Joystick
     Keyboard
     Library
     Light
     LinkedList
     Material
     Math
     Memory
     Menu
     Mesh
     Misc
     Module
     Mouse
     Movie
     Network
     OnError
     Packer
     Palette
     Particle
     Preference
     Printer
     Requester
     Sort
     Sound
     SoundPlugin
     Sprite
     Sprite3D
     StatusBar
     String
     SysTray
     Terrain
     Texture
     Thread
     Toolbar
     Window

 Dim


Syntax
Dim name.<type>(<expression>, [<expression>], ...) 
Description
Dim is used to 'size' the new arrays. An array in PureBasic can be of any types, including Structure structured, and user defined types. Once an array is 'sized' it can be resized but its content will be deleted. Arrays are dynamically allocated which means than a variable or an expression can be used to size them. When you define a new array, please note that it will have one more element than you used as parameter, because the numbering of the elements in PureBasic (like in other BASIC's) starts at element 0. For example when you define Dim(10) the array will have 11 elements, elements 0 to 10. This behaviour is different for static arrays in structures. Arrays are always globally accessable in PureBasic. This means that they can always be accessed from inside procedures without needing to use the Global or Shared commands. If you want to delete the content of an array and release its used memory during program flow, call Dim with array name and 0 elements. Note: Array bound checking is only done with activated Debugger.

Example:

  Dim MyArray.l(41)
  MyArray(0) = 1
  MyArray(1) = 2 
  Example 2 :
  
  Dim MultiArray.b(NbColumns,NbLines)
  MultiArray(10,20) = 10
  MultiArray(20,30) = 20



Hosted by Reel Media Productions Copyright©2001-2004 All Rights Reserved