InquirerDizon: Edsa Carousel bus fleet to reach 450 by year-endThe Jerusalem PostNearly 90 years after a German officer defied Nazis on Kristallnacht, police pledge to protect JewsCollider‘Tracker’ Meets ‘Reacher’ in Mark Wahlberg’s Action Hit That Is Officially Removed From Free StreamingSouth China Morning PostAmid the Xi-Trump clamour, can Apec revive the business of cooperation?Business AMAmerikaanse mariniers bereiden zich voor op mogelijke oorlog met China door commandocentra sneller te verplaatsenZDF heuteAktuelle Pressemitteilungen des ZDFABC News (Australia)Carpenter leads Chelsea to victory against Manchester City7sur7Une filiale de La Poste annonce “l’une des plus importantes fuites de données en France”The Sydney Morning HeraldCA responds to Warner's 'cover up' claimskickerLIVE! Dänemark düpiert Portugal nach erwiesener CR7-Ehre - Schweden zittert plötzlichRFI 中文特习会在即,美农民关注农产品贸易和关税问题BillboardThe Latin Recording Academy Celebrates Leading Ladies of Entertainment & More Uplifting Moments
The Daily Newsstand · Free, Always
Saturday, November 14, 2026

That key left of '1' on many keyboards is actually crucial for programmers

Translate

The humble tilde (~) symbol, which is located left of the "1" key, has a few notable uses. It can represent approximations, which is useful in mathematics and statistics, and is found as an accent over letters in languages like Spanish and Portuguese. You've probably spent some time hunting for it on a keyboard when spelling stuff like "mañana." However, its primary use on a computer keyboard is as a tool in programming languages C, C++ and Java, among many others.

This has actually been a handy little key going back decades. It first appeared on computer keyboards all the way back in 1965, back in the days of massive mainframes. It has since become a mainstay of modern keyboards. The meaning of the symbol depends entirely on the programming language, and even game developers find a variety of uses for it. Let's get into what coders are using the tilde for.

Bitwise NOT operator

This is likely the most common use of the tilde symbol when it comes to programming, as this method is the same in Javascript, C, C++, Python and several other computing languages. The bitwise NOT operator (yes it's spelled that way) inverts all the bits of a binary number. This means that all zeroes become ones and all ones become zeroes. For instance, "0010" would become "1101." 

This is a boon when optimizing systems and was actually used a lot when generating old-school video game graphics. It was a quick and dirty way to automatically invert colors. It's also used to index files and find missing elements in strings. There are many ways in which coders rely on this tool, depending on the specific programming language. It can even be used to flip a numerical digit, like "5", to its binary equivalent. 

There's even something called a double bitwise NOT operator, which is represented with two tildes standing side by side. This is typically used to truncate decimals.

Class destructor

Programmers using C++ or C# tend to rely on something called a class destructor. This is a special function that runs when an object has been deleted. It's primarily used to clean up resources, which help free allocated memory. Generally speaking, this is done by popping a tilde before the name of the object, or class, that will be deleted.

Video game programmers tend to use class destructors to free up memory when an object exits a player's field of view. This includes stuff like enemies, projectiles and even user interface windows. The destructor eliminates texture buffers, physics engines and anything else connected to the deleted object. 

As you can imagine, large-scale open-world games would struggle without this tool. Objects are constantly deleted as a player moves throughout the world. Without class destructors, massive in-game assets would continue to hog the memory even when they aren't present on the screen. That would make everything run as slow as molasses. 

General sibling selector

Programmers in CSS often use something called a general sibling selector, which is instigated with a tilde symbol. Simply put, this process automatically selects all matching elements that follow the tilde. This lets people target specific parts of the code even if they aren't directly next to each other, which allows for batch changes. This differs from the adjacent sibling selector, which only selects the element that comes immediately after the "+" symbol.

There are several use case scenarios for a general sibling selector, most of which involve changing the visual elements of a user interface, website, or web app. It's not popular in traditional video game development, because most engines don't use CSS for core game logic or rendering, but it is often found in web-based games. Programmers also find it handy when it comes to game launchers, store pages and settings menus. Again, that's because it's used to quickly change up the visual style.

View the original on Engadget →

KioskNews shows a cleaned-up reading view extracted from the publisher’s page — the original always lives on their site, not ours.