From c410311f55b3f00831b8d3de06fbd3084f705a3d Mon Sep 17 00:00:00 2001 From: Karl Goetz Date: Mon, 13 Jul 2020 19:15:44 +0000 Subject: [PATCH] Clarify that index_var is 0 indexed (#70548) A little further down the page is another index, ansible_loop.index, which shares a similar description but is 1 indexed. Its zero indexed twin has a 0 suffix. ``ansible_loop.index`` The current iteration of the loop. (1 indexed) ``ansible_loop.index0`` The current iteration of the loop. (0 indexed) To remove ambiguity around the usage of index_var, explicitly mention that this variable is 0 indexed. --- docs/docsite/rst/user_guide/playbooks_loops.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/docsite/rst/user_guide/playbooks_loops.rst b/docs/docsite/rst/user_guide/playbooks_loops.rst index 7830edbef7c..98cfd2575c0 100644 --- a/docs/docsite/rst/user_guide/playbooks_loops.rst +++ b/docs/docsite/rst/user_guide/playbooks_loops.rst @@ -352,6 +352,8 @@ To keep track of where you are in a loop, use the ``index_var`` directive with ` loop_control: index_var: my_idx +.. note:: `index_var` is 0 indexed. + Defining inner and outer variable names with ``loop_var`` --------------------------------------------------------- .. versionadded:: 2.1