doc: make int base section more concise (#5827)
parent
f5579525c4
commit
6a260ad974
27
doc/docs.md
27
doc/docs.md
|
@ -26,6 +26,7 @@ you can do in V.
|
||||||
* [Types](#types)
|
* [Types](#types)
|
||||||
* [Primitive types](#primitive-types)
|
* [Primitive types](#primitive-types)
|
||||||
* [Strings](#strings)
|
* [Strings](#strings)
|
||||||
|
* [Numbers](#numbers)
|
||||||
* [Arrays](#arrays)
|
* [Arrays](#arrays)
|
||||||
* [Maps](#maps)
|
* [Maps](#maps)
|
||||||
* [Imports](#imports)
|
* [Imports](#imports)
|
||||||
|
@ -39,10 +40,10 @@ you can do in V.
|
||||||
* [Trailing struct literal syntax](#short-struct-initialization-syntax)
|
* [Trailing struct literal syntax](#short-struct-initialization-syntax)
|
||||||
* [Access modifiers](#access-modifiers)
|
* [Access modifiers](#access-modifiers)
|
||||||
* [Methods](#methods)
|
* [Methods](#methods)
|
||||||
* [println](#println)
|
|
||||||
|
|
||||||
</td><td width=33% valign=top>
|
</td><td width=33% valign=top>
|
||||||
|
|
||||||
|
* [println](#println)
|
||||||
* [Functions 2](#functions-2)
|
* [Functions 2](#functions-2)
|
||||||
* [Pure functions by default](#pure-functions-by-default)
|
* [Pure functions by default](#pure-functions-by-default)
|
||||||
* [Mutable arguments](#mutable-arguments)
|
* [Mutable arguments](#mutable-arguments)
|
||||||
|
@ -61,13 +62,13 @@ you can do in V.
|
||||||
* [Testing](#testing)
|
* [Testing](#testing)
|
||||||
* [Memory management](#memory-management)
|
* [Memory management](#memory-management)
|
||||||
* [ORM](#orm)
|
* [ORM](#orm)
|
||||||
|
|
||||||
|
</td><td valign=top>
|
||||||
|
|
||||||
* [Writing documentation](#writing-documentation)
|
* [Writing documentation](#writing-documentation)
|
||||||
* [Tools](#tools)
|
* [Tools](#tools)
|
||||||
* [vfmt](#vfmt)
|
* [vfmt](#vfmt)
|
||||||
* [Profiling](#profiling)
|
* [Profiling](#profiling)
|
||||||
|
|
||||||
</td><td valign=top>
|
|
||||||
|
|
||||||
* [Advanced](#advanced)
|
* [Advanced](#advanced)
|
||||||
* [Calling C functions from V](#calling-c-functions-from-v)
|
* [Calling C functions from V](#calling-c-functions-from-v)
|
||||||
* [Debugging generated C code](#debugging-generated-c-code)
|
* [Debugging generated C code](#debugging-generated-c-code)
|
||||||
|
@ -394,24 +395,16 @@ a := 123
|
||||||
This will assign the value of 123 to `a`. By default `a` will have the
|
This will assign the value of 123 to `a`. By default `a` will have the
|
||||||
type `int`.
|
type `int`.
|
||||||
|
|
||||||
You can also use hexadecimal notation for integer literals:
|
You can also use hexadecimal, binary or octal notation for integer literals:
|
||||||
|
|
||||||
```v
|
```v
|
||||||
a := 0x7B
|
a := 0x7B
|
||||||
```
|
b := 0b01111011
|
||||||
... or binary notation for integer literals:
|
c := 0o173
|
||||||
|
|
||||||
```v
|
|
||||||
a := 0b01111011
|
|
||||||
```
|
|
||||||
... or octal notation for specifying integer literals:
|
|
||||||
|
|
||||||
```v
|
|
||||||
a := 0o173
|
|
||||||
```
|
```
|
||||||
|
|
||||||
All of these will assign the same value 123 to `a`. `a` will have the
|
All of these will be assigned the same value, 123. They will all have type
|
||||||
type `int` no matter what notation you have used for the integer literal.
|
`int`, no matter what notation you used.
|
||||||
|
|
||||||
V also supports writing numbers with `_` as separator:
|
V also supports writing numbers with `_` as separator:
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue