Technology news and discussion on TalkFuse.
Tilde key serves distinct roles across programming languages
The tilde key, usually found to the left of “1”, has several roles in programming, with its meaning varying by language. It matters because programmers use it for operations such as manipulating binary values, managing memory and selecting elements in web interfaces.
The symbol has been part of computer keyboards since 1965. In languages including JavaScript, C, C++, and Python, a single tilde can act as a bitwise NOT operator, flipping each binary digit; a double tilde is sometimes used to truncate decimals. In C++ and C#, a tilde before a class name denotes a destructor that cleans up resources, while CSS uses it to select matching sibling elements that follow another element.
In short
- The tilde has been on computer keyboards since 1965.
- It can flip binary digits in several programming languages.
- It also helps manage memory and select CSS elements.
Read the full article at the source →
Originally published by Engadget as “That key left of ‘1’ on many keyboards is actually crucial for programmers”.