Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
0 votes
4 answers
260 views

Language design : use equals symbol = both for affectation and comparison, like in MySQL

I'm currently designing a database query language and I came to wonder what should be the best syntax for the comparison operator. Most modern languages use ==, but amongst the database languages ...
ibi0tux's user avatar
  • 241
1 vote
2 answers
2k views

What are the most idiomatic abbreviations for comparison operators [closed]

I am wondering what the most idiomatic text abbreviations for comparison operators are. I need to build a custom enum with them, so I cannot use their symbols. To me personally, these seem idiomatic: ...
Felk's user avatar
  • 194
43 votes
10 answers
9k views

Why do most mainstream languages not support "x < y < z" syntax for 3-way Boolean comparisons?

If I want to compare two numbers (or other well-ordered entities), I would do so with x < y. If I want to compare three of them, the high-school algebra student will suggest trying x < y < z....
JesseTG's user avatar
  • 657
9 votes
4 answers
3k views

Using PHP's ternary operator with only two arguments

I was recently reviewing some of my code and noticed that in a fit of absent-mindedness, I'd left a structure like the following: $guid = empty($subscription->guid) ? : $subscription->guid; ...
Matthew Scharley's user avatar
29 votes
10 answers
6k views

Is there any reason why most programming languages don't have '!>' (not greater than) and '!<' (not less than) operators?

I wonder if there is any reason - or if it is just an accident of history - that there are no !> and !< operators in most programming languages? a >= b (a greater OR equals b) could be ...
Alex Burtsev's user avatar
3 votes
2 answers
306 views

Greater than or identical to?

While browsing my code in a weakly-typed language I was seeing that I've trained myself to use identity (===) where logical. Then I came across a greater (or less) than or equal to (>=), and it ...
Andrew's user avatar
  • 133