Forum Discussion
FICO
1 year agoCommunity Manager
How to traverse through an association ?
For example I have a association called as mapper as below
mapper is an association from string to string initially {
it["A"] ="a";
it["B"] = "b";
}
//I need to loop through each element
for each association in mapper do { // code fails here as this line is getting a compile error
if it.mapper ....contains text x then {
//Business logic
}
}
1 Reply
- FICOCommunity Manager
First, to fix your syntax error, it should be
for each string in mapper do {...}
Second, if you are trying to find if mapper has specific text in it, associations have a built in method of contains so you could say
if mapper.contains("text x") then ....
Related Content
Related Content
- 0Views0likes1Comment