Login
Community
DARK THEME

What is a "list" in microScript?

Hi! I've been doing a deeper study of programming here and wondered: what is a "list" in a microScript? Is it something like an array like in JavaScript or is this what it is? Or is it something like a table (like an array) in Lua. I really need to find out. It is interesting to find out how the list is arranged in a microScript in order to use it more efficiently. Thanks in advance for the answer:)

I think you could call it array instead, more details are in the documentation section :)

List operations

Operation Description
list.length Retains the length of the list (number of elements in the list).
list.push(element) Adds the element to the end of the list
list.insert(element) Inserts an element at the beginning of the list
list.insertAt(element,index) Inserts an element at the given index in the list
list.indexOf(element) Returns the position of the element in the list (0 for the first element, 1 for the second element ...). Returns -1 when the element is not found in the list.
list.contains(element) Returns 1 (true) when element is in the list, or 0 (false) when the element cannot be found in the list
list.removeAt(index) Removes from the list the element at position index
list.removeElement(element) Removes from the list element, if it can be found in the list
list1.concat(list2) Returns a new list obtained by appending list2 to list1

Hello TinkerSmith! The fact is that I want to understand the difference between a "list" and an "array" :) Since in microStudio this thing is called a "list" - but at the same time it's kind of like an "array" (Similar to an array in JS). So what's the difference? I studied this question for a long time, but probably didn't come across the necessary information :)

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community