3 ms·
https://stackoverflow.com/a/7611586 https://stackoverflow.com/a/7611586 claims K&R says it was added for symmetry, but in C and C++ it ¿nowadays? also converts
by Someone 6y ago
https://stackoverflow.com/a/7611586 https://stackoverflow.com/a/7611586 claims K&R says it was added for symmetry, but in C and C++ it ¿nowadays? also converts char to int. That can be useful to print the values of characters (std::cout << c outputs a char, std: court << +c its value).
In JavaScript: to convert strings to numbers.
In Python: to assert that a value is numeric (throws a TypeError if it isn’t).
In Perl: among others, replaces an initial ‘-‘ in a string by a ‘+’ and vice versa (https://perldoc.perl.org/perlop.html#Symbolic-Unary-Operators https://perldoc.perl.org/perlop.html#Symbolic-Unary-Operator.... See also https://perlmaven.com/the-magic-unary-plus https://perlmaven.com/the-magic-unary-plus for more power/weirdness)