[Gambas-user] How to realize AND, OR etc.

Rolf-Werner Eilert eilert-sprachen at ...221...
Thu Sep 2 10:39:51 CEST 2010


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




More information about the User mailing list