Skip to content

Conversation

@ehpc
Copy link

@ehpc ehpc commented Nov 16, 2025

You need brackets here if (r < 'a' || r > 'z') && r != '-' because bool || bool && bool == bool || (bool && bool) and as such we are basically ignoring r != '-'.

Proof:

func main() {
	r := '-'
	if r < 'a' || r > 'z' && r != '-' {
		fmt.Println("SHOULD NOT RUN")
	}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant