A small challenge to any ASOC guru’s out there.

How would you code the following objective-c in ASOC:

```
float minX = MIN(MIN(MIN(point0.x, point1.x), point2.x), point3.x);
```

–Terry

A small challenge to any ASOC guru’s out there.

How would you code the following objective-c in ASOC:

```
float minX = MIN(MIN(MIN(point0.x, point1.x), point2.x), point3.x);
```

–Terry

I have come up with this, does anyone have a better solution?

```
set tList to {tPoint0's x, tPoint1's x, tPoint2's x, tPoint3's x}
set minX to min_(tList)
on min_(theList)
set minVal to theList's item 1
repeat with i from 2 to count theList
if theList's item i < minVal then
set minVal to theList's item i
end if
end repeat
return minVal
end min_
```

This works too:

```
on min(a, b)
if a < b then
return a
else
return b
end if
end min
set x to min(min(min(min(5, 4), 3), 2), 9)
```

The advantage is that you can use it on as many variables as you need to. Yours is a bit easier to read, IMHO

doug