Case/switch

new topic     » topic index » view thread      » older message » newer message

Kat brought up case/switch. I'd love to see this become part of the 
language.

I was writing an artificial life program for Windows. Basically, it was 
a bunch of buttons in a grid. If a button was "hot", the program would 
check to see whether the button in the row above and to either side was 
"hot" to determine whether to make that button itself "hot".

Well, as you can imagine, that works fine for the buttons in the middle 
of the grid. But when you get to the buttons in the grid above, you have 
to check to see if a button is at a window edge. So there are a lot of 
"if button1 = leftedge or button2 = rightedge" kind of stuff. It got 
really tedious. The only think I could think was "This would be so much 
easier with a Case statement".

Is there some easy way to do that that I'm missing?

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu