Am 02.09.2010 11:20, schrieb Werner: > On 02/09/10 16:39, Rolf-Werner Eilert wrote: >> This is just a general question about programming, it doesn't refer to >> Gambas specifically, but I would implement the results in Gambas. >> >> For some of my bigger projects I have had to implement IF and ELSE and >> similar functions. I tried to manage AND, OR etc. too, but I failed. >> Somehow I didn't find a proper way of implementing this logic. So up to >> now I have filled this gap by simply putting several IF ELSE IF ELSE and >> so on within each other. Of course this is somewhat tricky sometimes :-) >> >> Could someone here explain me how an AND and an OR can be implemented? >> Are there general rules? I do not need the parser, it is there. I just >> ask about the logic behind AND and OR for instance. >> >> Here are my thoughts so far: >> >> - Parser puts IF-clauses into array and logic (AND/OR) in between or >> into separate list >> >> - IF-clauses are solved and results are stored e. g. in a boolean array >> >> - The ANDs and ORs from the list are processed with the boolean array >> into a final result >> >> This does not, however, include looking for bracketed clauses... Oh my >> goodness :-) >> >> Thanks for your help... >> >> Regards >> >> Rolf >> > No sweat, it's just Ones and Zeroes... :-D > > It is not very clear (to me) what you actually want to achieve. > You might want to take a closer look at the SELECT statement. It takes a > lot of clutter out of code. > > Regards > Werner
SELECT is just another view to IF (a somewhat limited version) I'd say. No, my question was: How can I implement such a logic in my own program? Regards Rolf ------------------------------------------------------------------------------ This SF.net Dev2Dev email is sponsored by: Show off your parallel programming skills. Enter the Intel(R) Threading Challenge 2010. http://p.sf.net/sfu/intel-thread-sfd _______________________________________________ Gambas-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/gambas-user
