Using the end keyword as a function argument

SantiagoOrtiz
Sun, 26 Mar 2023 00:53:34 +0000
General Usage

Hi,

Is there any way to pass the end keyword as an argument in a function or another index (i.e., -1 in python) to point to the last position of an array?

a = [1 2 3 4 5]

function f1(a, n)
    return a[n]
end

f1(a, end)
f1(a, -1)

Regards,
Santiago

4 posts - 4 participants