You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
374 B
29 lines
374 B
3 years ago
|
package main
|
||
|
|
||
|
import "fmt"
|
||
|
|
||
|
var temp int64 = 10
|
||
|
|
||
|
func main() {
|
||
|
fmt.Println(temp)
|
||
|
test()
|
||
|
fmt.Println(temp)
|
||
|
|
||
|
s := "test2"
|
||
|
suffix := ".png"
|
||
|
res := test2(s, suffix)
|
||
|
fmt.Println(res)
|
||
|
}
|
||
|
|
||
|
func test2(s, suffix string) bool {
|
||
|
t1 := len(s) >= len(suffix)
|
||
|
t2 := s[len(s)-len(suffix):] == suffix
|
||
|
temp := t1 && t2
|
||
|
return temp
|
||
|
}
|
||
|
|
||
|
func test() {
|
||
|
fmt.Println(temp)
|
||
|
temp = 100
|
||
|
}
|