Table of Contents

ugBASIC User Manual

ARRAY

SYNTAX

   ARRAY var = ...
   ARRAY var := ...

PURPOSE

The ARRAY keyword allows you to copy a block of memory from a static definition to an array at run time. In simple terms, it copies an array of bytes from the right expression to a var. It is especially useful when you want to initialize an array with a specific value or assign an entire array.

This method is generally faster than copying element by element, especially for large arrays. It provides a concise way to initialize an entire array with a constant value.

If you want to initialize an array to a single byte, memset is more efficient. For small arrays or when initializing elements with different values, direct assignment can be more readable.

EXAMPLE

  DIM var(4) AS BYTE
  ARRAY var = #{42424242}

ABBREVIATION

 Ar

AVAILABLE ON

ANY PROBLEM?

If you have encountered a problem using this command, if you think there is a bug or the explanation is unclear, please open an issue for this keyword on GitHub. Thank you!

POWERED BY