Re: Dynamic assignment of list name in iterator statement?

2023-03-05 Thread James McMahon
Yes indeed. A careless error one makes in the early hours of the morning. Thank you very much Søren. I am also going to look into Locale as Rachel G. encouraged . And Bob B. has replied with a sample I want to explore too. Thank you Bob and thank you Rachel. Jim On Sun, Mar 5, 2023 at 6:32 AM

RE: Dynamic assignment of list name in iterator statement?

2023-03-05 Thread Bob Brown
to great effect… HTH BOB From: Søren Berg Glasius Sent: Sunday, March 5, 2023 9:32 PM To: users@groovy.apache.org Subject: Re: Dynamic assignment of list name in iterator statement? Hi Jim, If your switch hits "English" it will also set the rest of the cases. You need a "break&

Re: Dynamic assignment of list name in iterator statement?

2023-03-05 Thread Søren Berg Glasius
Hi Jim, If your switch hits "English" it will also set the rest of the cases. You need a "break" after "containsEnglish = true" - just like in Java Med venlig hilsen, Søren Berg Glasius Hedevej 1, Gl. Rye, 8680 Ry Mobile: +45 40 44 91 88 --- Press ESC once to quit - twice to save the changes.

Re: Dynamic assignment of list name in iterator statement?

2023-03-05 Thread James McMahon
Was trying to come up with a Groovy way to collapse a lengthy switch statement to dynamically building the variable name. I've failed at that. Instead, I've fallen back on this option: switch("$k") { case "English": containsEnglish = true

Re: Dynamic assignment of list name in iterator statement?

2023-03-04 Thread James McMahon
Søren , May I ask you a follow up? I am trying what I thought I read in your reply (thank you for that, by the way). But I continue to get this error: "The LHS of an assignment should be a variable or a field accessing expression @ " This is what I currently have, attempting to set my

Re: Dynamic assignment of list name in iterator statement?

2023-02-23 Thread James McMahon
I see how this differs from my two initial attempts. Thank you very much Søren. This will work well. I'll visit this link and read more this morning. Jim On Thu, Feb 23, 2023 at 3:01 AM Søren Berg Glasius wrote: > Hi Jim, > > It is possible: > > languages = ['english', 'french', 'spanish'] >

Re: Dynamic assignment of list name in iterator statement?

2023-02-23 Thread Søren Berg Glasius
Hi Jim, It is possible: languages = ['english', 'french', 'spanish'] englishCharsList = ['a','b'] frenchCharsList = ['c','d'] spanishCharsList = ['e','f'] languages.each { lang -> this."${lang}CharsList".each { ch -> println "$lang -> $ch" } } Check it out here:

Dynamic assignment of list name in iterator statement?

2023-02-22 Thread James McMahon
Good evening. I have a list named languageCharactersList. I begin my iteration through elements in that list with this: languageCharactersList.eachWithIndex( it, i -> I hope to make this more generic, so that I can build a variable name that points to the appropriate list, which then allows me