Icône du site Apprenez Delphi

Exploring Multi-Dimensional Arrays in Delphi

#image_title

After introducing us to the single-dimensional arrays, Brandon Long is back for another session. This time, we will get to know more about two-dimensional arrays or multi-dimensional arrays and how to declare them in Delphi. This session is taken from the recently concluded Coding Boot Camp 2022 and the topic is based on Dr Kevin Bond’s book How to Program Effectively in Delphi for AS/A Level Computer Science. Here, Brandon Long will explore Arrays and their integral part not just in Windows application development but also in other platforms like Linux, macOS, and even mobile platforms like Android and iOS.

What You Should Know about Multi-Dimensional Arrays?

As we have learned from the previous session, arrays are one of the simplest data structures in Delphi that allow a developer to refer to a series of variables of the same data type and differentiate them using a number or an index. Generally, there are two types of arrays; One-dimensional (Single Dimensional) and Two-dimensional arrays (multi-dimensional). From the previous session, we were introduced to One-dimensional arrays, how they are declared and how they are initialized in Delphi. A One-Dimensional Array is a group of elements having the same data type which are stored in a linear arrangement under a single variable name. Brandon decided to build a Delphi app that allows him to store time data using the Single Dimensional array.

This time, he will expand the app’s functionality by using multi-dimensional arrays. If a one-dimensional array can be seen as data elements organized in a row, the two-dimensional array can be visualized as a grid or table with rows and columns. Brandon will demonstrate how 2D arrays are being initialized in Delphi, how to add values, and how to display them in the app. To learn more about arrays, feel free to watch the video below.  

Quitter la version mobile