// SPDX-License-Identifier: MITpragmasolidity ^0.8.18;contract Primitives {boolpublic boo =true;/* uint stands for unsigned integer, meaning non negative integers different sizes are available uint8 ranges from 0 to 2 ** 8 - 1 uint16 ranges from 0 to 2 ** 16 - 1 ... uint256 ranges from 0 to 2 ** 256 - 1 */uint8public u8 =1;uintpublic u256 =456;uintpublic u =123; // uint is an alias for uint256/* Negative numbers are allowed for int types. Like uint, different ranges are available from int8 to int256 int256 ranges from -2 ** 255 to 2 ** 255 - 1 int128 ranges from -2 ** 127 to 2 ** 127 - 1 */int8public i8 =-1;intpublic i256 =456;intpublic i =-123; // int is same as int256// minimum and maximum of intintpublic minInt = type(int).min;intpublic maxInt = type(int).max;addresspublic addr =0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c;/* In Solidity, the data type byte represent a sequence of bytes. Solidity presents two type of bytes types : - fixed-sized byte arrays - dynamically-sized byte arrays. The term bytes in Solidity represents a dynamic array of bytes. It’s a shorthand for byte[] . */bytes1 a =0xb5; // [10110101]bytes1 b =0x56; // [01010110]// Default values// Unassigned variables have a default valueboolpublic defaultBoo; // falseuintpublic defaultUint; // 0intpublic defaultInt; // 0addresspublic defaultAddr; // 0x0000000000000000000000000000000000000000}
Unsigned integer (whole number)
256 is the default if nothing is specified
But it's good to be specific and use uint256
Initializes as default 0 if not assigned a value as that is the null value in Solidity
Smallest is unit8 as 8 bits is a byte
Positive or negative whole number
bytes32 is the max size allowed
bytes can have "any size"?
But I think that will still limit the actual content to 32 bytes
Actually a type of bytes in the background, but only used for text