-
Book Overview & Buying
-
Table Of Contents
Getting Started with V Programming
By :
The number types or numeric types in V constitute a family of primitive numeric types, such as integers and floating-point types. Integer and floating-point types are further classified based on the ranges they support. Let's learn about the numeric types in detail.
A variable assigned with a whole number will be of the default data type int, which represents a 32-bit integer:
x := 1 typeof(x).name // int
V supports assigning numbers with _ as a separator. The _ is just for readability and doesn't affect the value of the number being defined.
Consider the following declarations here:
i := 1_000 j := 1000 println(i == j) // true
V allows you to declare integer variables with hexadecimal notation beginning with 0x, binary notation beginning with 0b, and octal notation beginning with 0o, as shown here:
module main
fn demo() {
h1 := 0x64 ...