docs: update type redeclaration example
parent
2464deec82
commit
bb20586a5e
|
@ -653,13 +653,18 @@ import time
|
||||||
|
|
||||||
type MyTime time.Time
|
type MyTime time.Time
|
||||||
|
|
||||||
|
fn (mut t MyTime) century() int {
|
||||||
|
return 1 + t.year % 100
|
||||||
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
my_time := MyTime{
|
my_time := MyTime{
|
||||||
year: 2020,
|
year: 2020,
|
||||||
month: 12,
|
month: 12,
|
||||||
day: 25
|
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