Skip to main content
WolfShade
Legend
January 22, 2020
Answered

Question about ListMap

  • January 22, 2020
  • 2 replies
  • 673 views

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 has been closed for replies.
Correct answer BKBK

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
June 15, 2020

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

 

Thank you for the explanation.

 

V/r,

 

^ _ ^

BKBK
Community Expert
BKBKCommunity ExpertCorrect answer
Community Expert
June 14, 2020

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.