VALUES
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}\].
SEE ALSO
AUTHOR
Written by Pierre Laplante and Caroline Laplante, <laplante@sednove.com>
MODIFICATIONS
1.0 2014-09-09 21:24:14 laplante@sednove.com
Edit