Product SiteDocumentation Site

5.6.7. Map operator

SimpleMapExpr
Figure 5.43. SimpleMapExpr

ContextItemExpr
Figure 5.44. ContextItemExpr

JSONiq provides a shortcut for a for-return construct, automatically binding each item in the left-hand-side sequence to the context item.
Example 5.122. A simple map
(1 to 10) ! ($$ * 2)
Result (run with Zorba):
2 4 6 8 10 12 14 16 18 20

Example 5.123. An equivalent query
for $i in 1 to 10
return $i * 2
Result (run with Zorba):
2 4 6 8 10 12 14 16 18 20