Sign in Join
Wiki copytemporary

And/fi: what changed

Revision 4 to 5. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
1-```
1+```text
22category:Suomi
33```
44
55# And (ja) boolean lausekkeessa
66
77**And** eli **ja** -operaatio antaa [[True|true]] eli tosi arvon vain silloin kun molemmat operandit ovat tosia (true). Muissa tapauksissa tuloksena on epätosi eli [[False|false]].
88
99## And eli ja-operaation totuustaulukko
1010
1111| A | B |   A and B (eli A ja B)   |
1212|:---------:|:---------:|--------------------------|
1313|   false   |   false   |   false |
1414|   false |   true |   false |
1515|   true |   false |   false |
1616|   true |   true |   true |
1717
1818# And eli ja bittikohtaisissa toiminnoissa
1919
2020Bitettäin tehtävä and (ja) asettaa kyseisen bitin ykköseksi (1) jos molemmat vastaavat bitit ovat ykkösiä (1). Muussa tapauksessa tulos on nolla (0).
2121
2222## Onko kakkosen potenssi
2323
2424``` pascal
2525function IsPowerOfTwo( const aValue : longint ): boolean;
2626var
2727 x : longint;
2828 b : boolean;
2929begin
3030 b := false;
3131 if aValue <> 0 then
3232 begin
3333 x := aValue - 1;
3434 x := x and aValue;
3535 if x = 0 then b := true;
3636 end;
3737 result := b;
3838end;
3939```
4040
4141Jos kutsutaan IsPowerOfTwo(4) niin saadaan true. Jos kutsutaan IsPowerOfTwo(5) niin saadaan false .
4242
4343### Lisätietoa
4444
4545- [[Not]]
4646- [[Shl]]
4747
4848- [[Const/fi|Const]]
4949- [[Function]]
5050- [[Integer/fi|Integer]]
5151
5252- [[Shl|Clear a bit]]
5353
5454---
5555*From the Free Pascal wiki, page "And/fi", as it stood on 2020-01-26 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history