Hi, all!

I'm new in Groovy and Script runner. I have the list of strings and I can't iterate them with cycles "for", "foreach" etc.:

data = ["1", "2", "3", "4", "5"]
for (e in data) {
println e

And as result I get:  no return value

Can you assist me in this issue?



2 answers

This widget could not be displayed.

I think the issue is that println is going to catalina.out, whereas Evgeniy is expecting it to be returned in the UI. The script console will return the value of the last statement executed, which for println, is nothing.

If you tail your catalina.out you should see it there, but that's not easy to debug like that.

This widget could not be displayed.


Just use the syntax like this:

data.each() {
	println "${it}"

You shoud read the docs about looping in groovy as well smile (http://groovy.codehaus.org/Looping).

You could use the simple Java syntax as well, but then it wouldn't be that fancy smile

Thank you. It's works)

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted yesterday in Teamwork

What teamwork quotes inspire you?

Hey everyone! My name is Natalie and I'm an editor of the Atlassian Blog and I've got a question for you: What's your favorite quote about teamwork?  We've compiled a list here, along with...

28 views 3 4
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you