[Gambas-user] How to realize AND, OR etc.
Werner
wdahn at ...1000...
Thu Sep 2 11:20:10 CEST 2010
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
More information about the User
mailing list