Visual basic memiliki banyak tipe data. Tipe data digunakan untuk mendeklarasikan variable. Saat deklarasi memori digunakan untuk alokasi tipe data. Masing-masing tipe data digunakan untuk menyimpan tipe nilai yang berbeda.
Tabel penggunaan memori untuk setiap tipe data.
No | Data Type | Storage | No | Data Type | Storage |
1 | Byte | 1 byte | 8 | String (variable-length) | Length + 10 bytes |
2 | Boolean | 2 bytes | 9 | String (Fixed-Length) | Length of string |
3 | Integer | 2 bytes | 10 | Currency | 8 bytes |
4 | Long | 4 bytes | 11 | Decimal | 12 bytes |
5 | Single | 4 bytes | 12 | Object | 4 bytes |
6 | Double | 8 bytes | 13 | Variant (numeric) | 16 bytes |
7 | Date | 8 bytes | 14 | Variant (text) | length +22 bytes |
Tabel range nilai tipe data
Data Type | Value Range |
Byte | 0 to 255 |
Boolean | True/False |
Integer | -32,768 to 32,767 |
Long | -2,147,483,648 to 2,147,483,647 |
Single | -3.402823*10^3 to -1.401298*10^45 for negative values
1.401298*10^-45 to 3.402823*10^38 for positive values |
Double | -1.79*10^308 to -4.94*10^-324 for negative values
4.94*10^-324 to 1.79*10^308 for positive values |
Date | January 1, 100 to December 31, 9999 |
String (Variable length) | 0 to approximately 2 billion characters |
String (Fixed length) | 1 to 65,400 characters |
Currency | -922,337,203,685,477.5808 to 922,337,203,685,477.5807 |
Decimal | +,-79,228,162,514,264,337,593,543,950,335 if no decimal is used
+,-7.9228162514264337593543950335 (28 decimal places) |
Object | Any object |
Variant (numeric) | Any value as 16px as Double |
Variant (text) | Same as variable length string |
Click here if you like this article.
2 Comments