Which Block Should be Used for Creating Arrays in Thunkable?

Thunkable is a popular platform for creating mobile applications without needing to write any code. It allows users to create their own applications using a simple, drag-and-drop interface. One of the most common tasks in app development is to create and manipulate arrays, which are collections of data. Thunkable provides several blocks that can be used to create arrays, but some blocks are more suitable than others, depending on the specific needs of the application.

In this article, we will discuss which block should be used for creating arrays in Thunkable, and provide activation codes for some of the most commonly used blocks.

Using the “make a list” block

The most basic block for creating arrays in Thunkable is the “make a list” block. This block allows you to create an array by specifying the individual elements that will make up the array. The elements can be of any data type, including text, numbers, and even other arrays.

To use the “make a list” block, simply drag it from the Blocks menu and drop it onto the design canvas. Then, enter the individual elements that you want to include in the array, separated by commas. You can also use variables or other blocks to specify the individual elements.

Activation code for the “make a list” block:

set myArray to make a list "apple", "banana", "orange"

 

Using the “create empty list” block

If you don’t know the individual elements that will be included in your array, or if you want to create an empty array that will be filled later, you can use the “create empty list” block. This block creates an empty array with no elements.

See also  How to Start Mobile Phone Shop Business in Pakistan ? Case Study

To use the “create empty list” block, simply drag it from the Blocks menu and drop it onto the design canvas. Then, assign the array to a variable so that you can later add elements to it.

Activation code for the “create empty list” block:

set myArray to create empty list

 

Using the “split text at spaces” block

Another common use case for arrays in Thunkable is to split a text string into an array of words. This can be done using the “split text at spaces” block. This block takes a text string as input and returns an array of individual words.

To use the “split text at spaces” block, simply drag it from the Blocks menu and drop it onto the design canvas. Then, specify the text string that you want to split into words.

Activation code for the “split text at spaces” block:

set myArray to split text at spaces "The quick brown fox"

 

Using the “list from CSV table” block

If you have data in a CSV format (comma-separated values), you can use the “list from CSV table” block to create an array from the data. This block takes a text string in CSV format as input and returns an array of arrays, where each sub-array represents a row of data.

To use the “list from CSV table” block, simply drag it from the Blocks menu and drop it onto the design canvas. Then, specify the CSV data that you want to convert to an array.

Activation code for the “list from CSV table” block:

set myArray to list from CSV table "name,age,gender\nJohn,25,Male\nJane,30,Female"

Conclusion

In summary, there are several blocks that can be used for creating arrays in Thunkable, depending on the specific needs of your application. The “make a list” block is the most basic and allows you to create an array by specifying the individual elements. The “create empty list” block is useful for creating an empty array that can be filled later.

See also  Free Download Chat Pro App aia File For Thunkable