From c06a71f653f3b239ace026c1e1966d9d73040c3a Mon Sep 17 00:00:00 2001 From: Leedehai <18319900+Leedehai@users.noreply.github.com> Date: Fri, 2 Feb 2024 03:52:58 -0500 Subject: Let for-loop iterate Dict with an iterator (#3318) --- docs/reference/scripting.md | 2 ++ 1 file changed, 2 insertions(+) (limited to 'docs/reference') diff --git a/docs/reference/scripting.md b/docs/reference/scripting.md index 6e64cebb..9a04bfb9 100644 --- a/docs/reference/scripting.md +++ b/docs/reference/scripting.md @@ -195,6 +195,8 @@ For loops can iterate over a variety of collections: - `{for pair in dict {..}}` \ Iterates over the key-value pairs of the [dictionary]($dictionary). The pairs can also be destructured by using `{for (key, value) in dict {..}}`. + It is more efficient than `{for pair in dict.pairs() {..}}` because it doesn't + create a temporary array of all key-value pairs. - `{for letter in "abc" {..}}` \ Iterates over the characters of the [string]($str). Technically, it iterates -- cgit v1.2.3