Sign in Join
Wiki copytemporary

And/fi: what changed

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

OldNewLine
1+```
2+category:Suomi
3+```
4+
15# And (ja) boolean lausekkeessa
26
37**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]].
48
59## And eli ja-operaation totuustaulukko
610
711| A | B |   A and B (eli A ja B)   |
812|:---------:|:---------:|--------------------------|
913|   false   |   false   |   false |
1014|   false |   true |   false |
1115|   true |   false |   false |
1216|   true |   true |   true |
1317
1418# And eli ja bittikohtaisissa toiminnoissa
1519
1620Bitettä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).
1721
1822## Onko kakkosen potenssi
1923
2024``` pascal
2125function IsPowerOfTwo( const aValue : longint ): boolean;
2226var
2327 x : longint;
2428 b : boolean;
2529begin
2630 b := false;
2731 if aValue <> 0 then
2832 begin
2933 x := aValue - 1;
3034 x := x and aValue;
3135 if x = 0 then b := true;
3236 end;
3337 result := b;
3438end;
3539```
3640
3741Jos kutsutaan IsPowerOfTwo(4) niin saadaan true. Jos kutsutaan IsPowerOfTwo(5) niin saadaan false .
3842
3943### Lisätietoa
4044
4145- [[Not]]
4246- [[Shl]]
4347
4448- [[Const/fi|Const]]
4549- [[Function]]
4650- [[Integer/fi|Integer]]
4751
4852- [[Shl|Clear a bit]]
4953
5054---
5155*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).*
52-Category: Suomi

Back to history