Re: Elegant way to eliminate large conditional?
Re: Elegant way to eliminate large conditional?
- Subject: Re: Elegant way to eliminate large conditional?
- From: Robert Tillyard <email@hidden>
- Date: Sat, 4 Jan 2003 04:17:16 +0000
If your code is in 'C' you could use a table/array of function
pointers, I don't know how to do that in Obj-C.
Regards, Rob.
On Saturday, January 4, 2003, at 03:50 am, Andrew Merenbach wrote:
I'm developing a program that includes a unit converter which, among
other things, can convert from any one of five temperature scales to
any of the other five temperature scales. The code is hard to
maintain, unfortunately, as I use a rather long conditional (with
multiple sub-conditionals) to determine the "to" and "from" scales.
Is there some (elegant) way to use a matrix-like setup (a
two-dimensional selector or even an array?) that, given two arguments
(a range of five numbers, for each of the temperature scales) will
execute a different one of 25 equations or selectors?
Take care,
Andrew Merenbach
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.