Skip to content

Why can I not use the greater than operator with the default key word? #4477

Answered by 333fred
TylerDM asked this question in Q&A
Discussion options

You must be logged in to vote

The default literal keyword needs to be "target-typed" in order to figure out what type it should represent. We don't have any rules for inferring target-types for one side of an operator like > or < from the other side, so id cannot inform default what type it should be. I would also say that, IMO, this type of code relatively unclear, and it's much better to just use 0.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by TylerDM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants