Skip to content

Instantly share code, notes, and snippets.

@mattn
Created June 30, 2017 00:27
Show Gist options
  • Select an option

  • Save mattn/b9621b8fcff585be7d5a57a3ae55bc9a to your computer and use it in GitHub Desktop.

Select an option

Save mattn/b9621b8fcff585be7d5a57a3ae55bc9a to your computer and use it in GitHub Desktop.
func check(s string) bool {
i, l := 0, len(s)
for ; i < l; i++ {
if s[i] != '4' {
break
}
}
if i == 0 {
return false
}
for ; i < l; i++ {
if s[i] != '0' {
return false
}
}
return true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment