Sign in Join
Wiki copytemporary

Byte/it: what changed

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

Title: Byte/it

OldNewLine
1+Un **byte** è un [[Integer/it|intero]] senza segno che può assumere valori che vanno da 0 a 255. Un byte e un [[Char/it|char]] sono la stessa cosa, con la differenza che il byte può contenere solo valori numerici, mentre il char può contenere un carattere o una parte di una [[String|stringa]], e non può essere usato in espressioni aritmetiche.
2+
3+Ad esempio:
4+
5+``` pascal
6+var
7+ c: byte;
8+ ch: char;
9+begin
10+ c := 65; ch := 'A'; { sono la stessa azione, ed è legittimo }
11+ c := 'A'; ch := 65; { questo è illegittimo }
12+end.
13+```
14+
15+l'uso di char o byte come tipi di dato permette una migliore comprensione circa l'utilizzo di una determinata variabile. Il char può essere [[coersion|convertito]] in byte usando la funzione **[[Ord|ord]]**. I valori delle variabili di tipo byte possono essere convertiti in char tramite **[[Chr|chr]]**.
16+
17+Il precedente programma reso legittimo:
18+
19+``` pascal
20+var
21+ c: byte;
22+ ch: char;
23+begin
24+ c := 65; ch := 'A'; { sono la stessa azione, e sono legittimi }
25+ c := ord('A'); ch := Chr(65); { ora legittimo }
26+end.
27+```
28+
29+---
30+*From the Free Pascal wiki, page "Byte/it", 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).*

Back to history