CONCEPT
Spaceship Operator
Spaceship Operator
- The Spaceship Operator (
<=>) is a three-way numeric comparison operator introduced into modern programming language design by Larry Wall in Perl (and subsequently adopted in PHP, Ruby, C++20, and Groovy). - It compares two operands and returns
-1,0, or1based on whether the left operand is less than, equal to, or greater than the right operand, primarily used in sorting routines. - The iconic name "spaceship operator" originated from early 1970s text-based Star Trek minicomputer games written in BASIC, where
<=>was used to render the USS Enterprise on teletype terminals. See The Star Trek BASIC Game and the Spaceship Operator.
What links here
These facts are as Randal recalls them, but much time has passed for most of this. If you find a factual error, please email realmerlyn@gmail.com.