Skip to main content
WolfShade
Legend
Jan 22, 2020 4:29 PM UTC
Answered

Question about ListMap

Hello, all,

 

Just a quick question about ListMap.  According to the Adobe Help page, ListMap "Iterates over every entry of the list and calls the closure function to work on the item of the list."

 

I'm curious, though, if break will break out of the iteration. If ListMap is just a shortcut to a loop, then break would break out of that loop.  But if ListMap is something else, then maybe break won't work?

 

Just curious.

 

V/r,

 

^ _ ^

This topic is closed to new replies. Start a new post to keep the conversation going.
BKBK
BKBKCorrect answer
Community Expert
Jun 14, 2020 12:42 PM UTC

Hi WolfShade,

When the documentation says, "Iterates over every entry of the list and calls the closure function to work on the item of the list", it indeed means ListMap will loop through the list. However, the implementation of ListMap doesn't offer any opportunity to include a break. 

Including break within the closure won't work for the map as a whole. That is because the map is designed to iterate over every entry of the list.

2 replies

WolfShade
WolfShadeAuthor
Legend
Jun 15, 2020 2:04 PM UTC

AH!  I was wondering why break wouldn't work in ListMap, I'm assuming same for ArrayMap.

 

Thank you for the explanation.

 

V/r,

 

^ _ ^

Translate
BKBK
Community Expert
BKBKCommunity ExpertCorrect answer
Community Expert
Jun 14, 2020 12:42 PM UTC

Hi WolfShade,

When the documentation says, "Iterates over every entry of the list and calls the closure function to work on the item of the list", it indeed means ListMap will loop through the list. However, the implementation of ListMap doesn't offer any opportunity to include a break. 

Including break within the closure won't work for the map as a whole. That is because the map is designed to iterate over every entry of the list.

Translate