type.array.last
0.000001

Gets values at the end of an array.

Arguments
count
The number of values to return. Defaults to 1
Return Value
The last value of the given array, or an array with the last n values when count is given.

By default, only the last value of the array is returned.

something went wrong :(
Getting the last value from an array
Setup
authorization=PROCAUTH
require "proc"

client = Proc.connect("PROCAUTH")
const Proc = require("@proc.dev/client");
const client = Proc.connect("PROCAUTH");
client.type.array.last.call(
  ["foo", "bar", "baz"]
)
client.type.array.last.call(
  ["foo", "bar", "baz"]
);
curl "https://proc.run/type/array/last" --silent \
--header "authorization: bearer $authorization" \
--header "content-type: application/json" \
--data '["foo", "bar", "baz"]'
 

baz

If count is passed, type.array.last returns a new array with the last n items from the end of the given array.

something went wrong :(
Getting the last two values from an array
Setup
authorization=PROCAUTH
require "proc"

client = Proc.connect("PROCAUTH")
const Proc = require("@proc.dev/client");
const client = Proc.connect("PROCAUTH");
client.type.array.last.call(
  ["foo", "bar", "baz"], count: 2
)
client.type.array.last.call(
  ["foo", "bar", "baz"], {count: 2}
);
curl "https://proc.run/type/array/last?count=2" --silent \
--header "authorization: bearer $authorization" \
--header "content-type: application/json" \
--data '["foo", "bar", "baz"]'
 

["bar", "baz"]


Stuck? Want to chat about an idea? Join the community on Discord.