![Programming from scratch with Xojo: Collections: Arrays and areas of use](/images/posts/f6f136277fa82a5406093ec34c13b222-0.jpg)
In this chapter of the Xojo Programming Course we begin to see the use of Collections in the programming language, starting from the declaration and definition of Arrays and their management.
We also see how scope affects: from the local scope as part of its use in the block of an event, function or method… or when it becomes an extra property as part of another object (for example, a window or application instance).
Think of data collections as a special type of variable that will allow us to "group" several elements of the same data type declared under the same label. This is particularly convenient because, for example, we will avoid having to define and use as many variables as there are data that we are going to assign to each of them ... and even more if we do not know in advance how many values we will work with!
For example, think of an address book that manages contact records. How many variables would you need in advance to save a contact in each of them? What if you need to create multiple contacts at runtime? Collections solve both questions in one fell swoop: you just have to declare ONE variable, declare the data type you are going to assign (one or more, defined at application design time or DURING application execution) and smart .
Of the different data collections we can use, the simplest is the array. This can work as a simple list, saving for example a series of values so that their data can be accessed (or replaced) by accessing them via the index or position they occupy in the array; or they can also be multidimensional (like an array or a table).
Another concept that we will see in this video is the field of variables. That is, to what extent are they available and can we access them? Don't worry because it is explained in a way that you understand the different areas (or domains) that exist.
So depending on where you declare a variable (or property) you will only be able to access it from the block of code in which it was declared, from the object or from other objects, which is very interesting when designing applications.
Of course, we also continue to make progress in using and explaining the different controls or UI elements, as well as using the debugger built into the IDE. This way, you will be able to follow the execution of your code step by step to find possible problems, points for improvement or detect bottlenecks.
Remember that you can always download Xojo from: www.xojo.com/download, as well as express your concerns in the Xojo Forum in Spanish (https://forum.xojo.com/c/international/espanol/31).
If you have any questions about how to do something about Xojo, don't hesitate to leave a comment!
Get 20% off the purchase of any version of Xojo, leaving a comment on this news, explaining what you will use it for.
Our Customers nove coupon, which will be distributed in order of comment.
Promotion valid until the end of April