Skip to main content

Command Palette

Search for a command to run...

Programming and Intuition

Published
1 min read

Javascript:

console.log("A" > "a") //Intuition says true

Swift:

print("A">"a") //Intuition says true

What is the expected result? My mental about English alphabets were Upper case letters were bigger than Lower case letters. Hence I expected the result to be true.

Result is:

false

Why is my intuition wrong?

My mental model of alphabets was correct in Real-world but the Programming languages' model about alphabets are different than mine.

Index of a in Unicode table - 0061

Index of A in Unicode table - 0041

Screenshot 2021-04-11 at 10.13.13 PM.png

An interesting perspective I read about Intuition and programming is here

References:

https://www.unicode.org/charts/PDF/U0100.pdf

https://unicode-table.com/en/#basic-latin

https://javascript.info/comparison

More from this blog

art-of-software-engineering

18 posts