mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
docs: update type redeclaration example
This commit is contained in:
parent
2464deec82
commit
bb20586a5e
@ -653,13 +653,18 @@ import time
|
||||
|
||||
type MyTime time.Time
|
||||
|
||||
fn (mut t MyTime) century() int {
|
||||
return 1 + t.year % 100
|
||||
}
|
||||
|
||||
fn main() {
|
||||
my_time := MyTime{
|
||||
year: 2020,
|
||||
month: 12,
|
||||
day: 25
|
||||
}
|
||||
println(my_time.unix_time())
|
||||
println(time.new_time(my_time).utc_string())
|
||||
println('Century: ${my_time.century()}')
|
||||
}
|
||||
```
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user