[fpc-pascal] C# translatation
Dmitry Boyarintsev
skalogryz.lists at gmail.com
Sun Jan 8 18:30:36 CET 2017
On Sun, Jan 8, 2017 at 12:22 PM, Sven Barth <pascaldragon at googlemail.com>
wrote:
> The closest equivalence to bitwise and in Pascal is bitwise and.
>
> The operators "and", "or", "xor" and "not" are logical or bitwise
> depending on their arguments.
>
With that said...
On Sun, Jan 8, 2017 at 11:46 AM, José Mejuto <joshyfun at gmail.com> wrote:
>
> Both work the same way but pascal does not have the assignment and testing
> mess that can be written in C like:
>
> C / C++:
>
> a = b && c;
>
> Pascal:
>
> a := (b<>0) and (c<>0);
>
There's another approach to resolved that.
The following code works as expected
{$mode objfpc}
var
b,c : integer;
a : Boolean;
ai : integer;
begin
b:=2;
c:=3;
ai:=b and c;
a:=boolean(b) and boolean(c);
writeln(a);
writeln(ai);
writeln(byte(a));
end.
output:
TRUE
2
1
thanks,
Dmitry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20170108/ac3fd2c9/attachment.html>
More information about the fpc-pascal
mailing list