# Tag Info

### Implement the <=> three-way comparison operator on numbers

polyglot, 3 bytes <=> Try it in Perl! <Insert other languages that already have the exact <=> operator here>

### Implement the <=> three-way comparison operator on numbers

BQN, 2 bytes ×- Try it at BQN REPL × # sign of - # left arg minus right arg BQN, 3 bytes ...
• 35.9k

### Implement the <=> three-way comparison operator on numbers

Python 2, 3 bytes cmp A built-in function that accepts $a$ and $b$ and returns $a \lt = \gt b$. Try it online!
• 108k

### Implement the <=> three-way comparison operator on numbers

JavaScript (ES6), 17 bytes Expects (a)(b). a=>b=>(a>b)-(a<b) Try it online!
• 195k

### Compare two strings, with NaC

Python, 92 bytes [🧍‍♂️👫🧍🧑‍🤝‍🧑🧍‍♂️] This is a community effort: Jonathan Allan's and Mukundan314's significant (-37 bytes) improvements on my original idea. ...
• 3,694

### Implement the <=> three-way comparison operator on numbers

Go, 52 51 bytes func(a,b int)int{n:=1 for-1<n&&b-a<n{n--} return-n} Attempt This Online! By @Kevin Cruijssen. Uses a ...
• 10.4k

### Implement the <=> three-way comparison operator on numbers

Python 3, 22 bytes lambda a,b:(a>b)-(a<b) Try it online! Python 3 lacks the builtin cmp -1 thanks to Dominic van Essen
• 7,644

### Compare two strings, with NaC

Jelly,  19  16 bytes Ḳj¥þØAZŒpM€§QḌ«4 A monadic Link that accepts a pair of lists of characters (from A-Z plus the space ...
• 108k

### Implement the <=> three-way comparison operator on numbers

Java (JDK), 14 bytes Float::compare Try it online! Java (JDK), 13 bytes Long::compare Try it online! Only supports integers.
• 2,789

### Implement the <=> three-way comparison operator on numbers

K (ngn/k), 9 bytes 1&-_1^-%- Try it online! K lacks a sign builtin, which makes this a bit trickier. -%- negative square ...
• 59.9k

• 15.7k

### Implement the <=> three-way comparison operator on numbers

Pascal, 55 Bytes function f(a,b:real):real;begin f:=ord(a>b)-ord(a<b)end
• 1,010

### Implement the <=> three-way comparison operator on numbers

Charcoal, 12 bytes ＮθＮηＩ⁻›θη‹θη Try it online! Link is to verbose version of code. Explanation: Port of @Arnauld's JavaScript answer. Alternative approach, also 12 ...
• 174k

### Implement the <=> three-way comparison operator on numbers

Retina 0.8.2, 29 bytes \d+ \$* (1*) \1 0 1+0 1 01+ -1 Try it online! Link includes test cases. Only works on non-negative integers. Explanation: ...
• 174k