function

values . context . sncode

VERSIONlatest Returns the list of values of a context.

VALUES(1e)

NAME

values - Returns the list of values of a context.

SYNOPSIS

values (variable);

DESCRIPTION

This function is used to return the list of values of a context. It returns each element associated with the ones defined at the beginning. If it used as a function, it returns the list of values as an array. However, if it is used as a callback, it returns each key.

PARAMETERS

variable
Specify a variable of type context to list the values.

RETURN

This function returns an array of all values if it used as a function, or each keys in a loop if it is used as a callback.

EXAMPLES

Note: In the followings examples, the _ between the { should be removed to make it work.

res={_{ for i values({x:1,y:2}) do i; endfor; }}. return res=12.
res={_{ for i values({x:[1,3],y:{a:2,b:"4"}}) do i; endfor; }}. return res=\[1,3\]\{"a":2,"b":"4"\}.
res={_{ a={x:1,y:2}; for i values(a) do i; endfor }}. return res=12.
res={_{ a={}; for i values(a) do i; endfor }}. return res=.
res={_{ for i values({}) do i; endfor }}. return res=.
res={_{ for i values(123) do i; endfor }}. return .*is not a context.*

res={_{ values({x:1,y:2}); }}. return res=\[1,2\].
res={_{ a={x:1,y:2}; values(a); }}. return res=\[1,2\].
res={_{ values({}); }}. return res=\[\].
res={_{ values(123); }}. return .*is not a context.*
res={_{ a={x:[1,3],y:{a:2, b:4}}; values(a); }}. return res=\[\[1,3],\{"a":2,"b":4}\].

AUTHOR

Written by Pierre Laplante and Caroline Laplante, <laplante@sednove.com>