• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Elegant way to eliminate large conditional?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Elegant way to eliminate large conditional?


  • Subject: Elegant way to eliminate large conditional?
  • From: Andrew Merenbach <email@hidden>
  • Date: Fri, 3 Jan 2003 19:50:47 -0800

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.

  • Follow-Ups:
    • Re: Elegant way to eliminate large conditional?
      • From: Jeff Szuhay <email@hidden>
    • Re: Elegant way to eliminate large conditional?
      • From: Thomas Hopper <email@hidden>
    • Re: Elegant way to eliminate large conditional?
      • From: Andrew <email@hidden>
    • Re: Elegant way to eliminate large conditional?
      • From: Drew McCormack <email@hidden>
    • Re: Elegant way to eliminate large conditional?
      • From: Jonathan Jackel <email@hidden>
    • Re: Elegant way to eliminate large conditional?
      • From: "John C. Randolph" <email@hidden>
    • Re: Elegant way to eliminate large conditional?
      • From: Robert Tillyard <email@hidden>
  • Prev by Date: Re: Internet programming, point me?
  • Next by Date: Re: Elegant way to eliminate large conditional?
  • Previous by thread: Re: beginSheetForDirectory
  • Next by thread: Re: Elegant way to eliminate large conditional?
  • Index(es):
    • Date
    • Thread