How to resolve the algorithm Arrays step by step in the EMal programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Arrays step by step in the EMal programming language
Table of Contents
Problem Statement
This task is about arrays. For hashes or associative arrays, please see Creating an Associative Array. For a definition and in-depth discussion of what an array is, see Array.
Show basic array syntax in your language.
Basically, create an array, assign a value to it, and retrieve an element (if available, show both fixed-length arrays and
dynamic arrays, pushing a value into it).
Please discuss at Village Pump: Arrays.
Please merge code in from these obsolete tasks:
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Arrays step by step in the EMal programming language
Source code in the emal programming language
^|EMal has dynamic lists.
|Lists have differen API to change the value in-place or not.
|SQL like name: insert, append, delete, order alter the current list.
|There are methods that operate on indexes, other on values.
|^
List a = int[] # a:[]
a.append(8) # a:[8]
a.insert(1, 13) # a:[8,13]
a.delete(0) # a:[13]
a.clear() # a:[]
a.of(21, 33) # a:[21,33]
a[1] = 34 # a:[21,34]
List b = a.remove(21) # a:[21, 34], b:[34]
writeLine("a has " + a.length + " items, their values are " + a[0] + ", " + a[1])
writeLine("b has " + b.length + " item, its value is " + b[0])
You may also check:How to resolve the algorithm Greatest common divisor step by step in the Euler programming language
You may also check:How to resolve the algorithm Sequence of non-squares step by step in the BASIC256 programming language
You may also check:How to resolve the algorithm Inheritance/Single step by step in the Oforth programming language
You may also check:How to resolve the algorithm Strip whitespace from a string/Top and tail step by step in the Groovy programming language
You may also check:How to resolve the algorithm Voronoi diagram step by step in the Lua programming language