I dont know much about imperative but in this example are you getting just 1 result because you are telling it to return the first true result rather than adding it to a list of results.
At a guess, maybe something like this instead?
a;
_Farbe1;
_Farbe2;
_Farbe3;
_Farbe4;
_Farbe5;
result = [Imperative] {
result = [];
if (a == 0.5) {
result.append(1);
}
elseif (a == 1.0) {
result.append(2);
}
elseif (a == 1.5) {
result.append(3);
}
elseif (a == 2.25) {
result.append(4);
}
else {
result.append(5);
}
return result;
};
If you want to work with lists you have to iterate over the items.
You are treating a as an item but a is a list, that can´t work out.
aList; // List of radiuses, e.g., [0.5, 1.0, 2.25]
_Farbe1;
_Farbe2;
_Farbe3;
_Farbe4;
_Farbe5;
y = [Imperative]
{
results = []; // List to hold results for each radius
for(a in aList) { // Loop through each radius in the list
if(a == 0.5) {
results.append(_Farbe1);
}
elseif (a == 1.0) {
results.append(_Farbe2);
}
elseif (a == 1.5) {
results.append(_Farbe3);
}
elseif (a == 2.25) {
results.append(_Farbe4);
}
else {
results.append(_Farbe5);
}
}
return results; // Return the list of results
};
Working with lists in Imperative is different from Associative. In Associative you work with lists as a whole (with lacing taking care of the manner in which elements between lists are computed). In Imperative you step through list elements individually.