mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
docs: fix the century algorithm example in docs.md (#7549)
This commit is contained in:
@ -747,11 +747,12 @@ However, you _can_ redeclare a type.
|
|||||||
|
|
||||||
```v
|
```v
|
||||||
import time
|
import time
|
||||||
|
import math
|
||||||
|
|
||||||
type MyTime = time.Time
|
type MyTime = time.Time
|
||||||
|
|
||||||
fn (mut t MyTime) century() int {
|
fn (mut t MyTime) century() int {
|
||||||
return 1 + t.year % 100
|
return int(1.0 + math.trunc(f64(t.year) * 0.009999794661191))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
Reference in New Issue
Block a user