Forum Academy Marketplace Showcase Pricing Features

"List" vs "Array"?

What’s the difference between a List in Bubble-world vs an Array in html/sql? I’m having conceptual issues understanding how to store/retrieve dynamic records of data.

If I wanted to add/subtract text data multiple times to the same Field of a Type, should I keep using “Create a new” and add on to the same data, or use a List and add/subtract to the list? If Bubble treats Lists like Arrays, I would assume to do the later.

Example: Profiles of people’s favorite foods. Type of data is Person, field is Favorite_Food and Name. Steve likes pizza, so Person’s Favorite_Food = “pizza”. The next entry I want to add that Steve also likes noodles, but I want to retain that he still likes pizza. So Create new…Person->Favorite_Food = “noodles”? Or should pizza and noodles be on a List that I can independently manipulate later?

Or, another way:

Data Type: Person
Name: Steve
Favorite_Food: pizza

Data Type: Person
Name: Steve
Favorite_Food: noodles

//or

Data Type: Person
Name: Steve
Favorite_Food: pizza, noodles

Thanks!

In computer science, an array is a contiguous allocation of memory used to store data; whereas, a list is a data structure that can store the same data in a non-contiguous way, allowing you to easily make modifications anywhere in the list. The implementation of a list isn’t too important when comparing it against arrays.

This really depends on if you are interested in a single object or a list of objects. Related to your example, are you only interested in a person’s favorite food (singular) or a person’s favorite foods (plural)? Use a list for the latter. You can also maintain a list of size 1 if you are unsure at the moment and want to limit how much refactoring you’ll need to do later.

1 Like