Sign in Join
Wiki copytemporary

Byte/fi: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: Byte/fi

OldNewLine
1+Byte on etumerkitön kokonaisluku alueella 0 .. 255. Se on 8 bittiä pitkä. Byte ja [[Char]] ovat samoja asioita paitsi byte voi viitata vain numereeniseen tyyppiin kun taas char käytetään merkeillä tai osana merkkijonoa. Eikä char:a voi käyttää matemaattisissa lausekkeissa.
2+
3+Esimerkiksi:
4+
5+``` pascal
6+ Var c: byte;
7+ ch: char;
8+
9+ begin
10+ c := 65; ch := 'A'; { are the same action, and are legal }
11+ c := 'A'; ch := 65; { while they are the same action, this is illegal }
12+ end.
13+```
14+
15+Käyttämällä Byte:ä tai Char:a tietotyyppinä saadaan parempi dokumentaatio muuttujan yksityiskohtaisesta käyttäytymisestä. Byte-tyyppi voidaan pakottaa char:ksi käyttämällä [[Chr|chr]]-funktiota. Char-ttyppi voidaan pakottaa byte:ksi käyttämällä [[Ord|ord]]-funktiota.
16+
17+yllä oleva ohjelma korjattuna:
18+
19+``` pascal
20+ Var c: byte;
21+ ch: char;
22+
23+ begin
24+ c := 65; ch := 'A'; { are the same action, and are legal }
25+ c := ord('A'); ch := Chr(65); { now legal }
26+ end.
27+```
28+
29+---
30+*From the Free Pascal wiki, page "Byte/fi", as it stood on 2020-02-10 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).*
31+Category: Suomi

Back to history