|
The main reason for the select/switch statements, IMO, is for code readability. You are indeed right that select/switch statements are nothing more than re-worded if...else...else...EndIf statements. The confusion comes in with nested if...else statements that are nested, which else are you talking about? In some languages it's easy to figure out, in some languages it's next to impossible. if A = 'On' If B = 2 ... do something else If B = 3 ... do something else else ... do something else EndIf EndIf else If A = 'Unswitched' If B = 2 ... do something Else I don't remember which language it was, but the compiler itself would get confused as to which else when to which else statement, so that it might apply the Else from B = 3 to the If from If A = 1. I had to use a lot of kludges in that language. The way I fixed it was to use either Select or Switch statements. Select When A = 'On' If B = 2 ... Do Something Else If B = 3 ... etc.. The exact some program, but changing from If... else to Select...When made it easier of the compiler, me, and anyone who followed me to understand. Regards, Jim Langston -----Original Message----- From: Richard B Baird [mailto:rbaird@esourceconsulting.com] be careful what you say Jim... ... they would be confused, kinda like i am now, on why we needed an 'if elseif' construct, as opposed to the 'select when' construct? :) rick
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.