So I've been given this question and I don't know it can anyone help?
We have a list of User and User class has name,surname properties. Which is the shortest code to get
a list of all the surnames?
Code
def newList = []
User.each{
newList.add(user.surname)
}
for( i in User{
newList.add(i.surname)
}
How far off am i? It does mean a list of user objects right? so I can just go User.name / User.surname to get at that value?
//i'm not sure on the question it's worded funny that is why i'm posting here
This post was edited by Atonement on Jul 5 2012 07:19am