+ 6
What's ascii sign 96 (`) good for?
This sign is called 'grave accent', Google tells me that much. I know that this is part of the French language, like è, but how has it made its way into ascii code, and nothing else from accent kingdom? Are there special programming-related use cases for it or some other use which made it impossible to ban it from 0-127?
9 ответов
+ 7
HonFu
Didn't know this is called `grave accent` 🤔
We call it back tick in JS.
Don't know much of it but it's quite useful.
I guess this is used in Kotlin also
[edit:
"reserved keywords in kotlin can still be used as names for functions and properties if they are enclosed with backticks (`)."
src:https://medium.com/@fanisveizis/how-expressive-can-kotlin-code-be-aka-fun-with-backticks-infixes-and-extensions-f730cdf45311
]
You can do something like this.
let n = 42;
console.log(`answer to every question is ${n} `);
// that looks clearer than using single or double quotes. Moreover they need a + for concatination so backticks are better. I guess.
More on it :
https://thebittheories.com/the-3-advantages-of-backtick-literals-in-javascript-f6beade4a9cf
https://stackoverflow.com/questions/27678052/usage-of-the-backtick-character-in-javascript
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals
https://jack.ofspades.com/multiline-strings-in-es6-javascript/
+ 6
Wow, thank you, guys, so there are a lot of ways to use them!
+ 5
-`/ well for ninja emoticon of course! :D
https://unix.stackexchange.com/questions/123650/what-is-the-character-or-symbol-called-and-what-is-its-significance-outside-of
+ 4
In markdown which is commonly used for formatting text in chatrooms and forums and on other websites, the backticks denote `some_code();`
(which is why I use them here even though we don't have markdown formatting, once SL implements it all my posts will be formatted already :D)
EDIT: But I see your question was about something else, I shall do research!
+ 3
I came up surprisingly empty-handed.
` was not in the 5-bit pre-ASCII Baudot code simply because there wasn't enough space. As a result the first version of ASCII from 1963 did not have it either, but as early as 1965 the grave accent was in it. But why not acute?
I looked at early programming languages from the time and some links I found indicate that in CPL and PL/I string literals were written as
`Hello world‘
But imo that must be a printing mistake as other sources clearly write it as
'Hello world'
(CPL never had a spec so its hard to tell)
It makes sense though because a language obviously cannot use symbols that aren't writeable yet.
I have seen older email threads that quote things like
`Hello world'
So maybe that was a common thing to do and the reason why ` is in ASCII has to do more with writing and less with programming. But I'm pulling at straws, I really have no idea.
Even my android keyboard cant do a forward tick/acute accent so I'm clearly missing something.
+ 3
Nice, though, Schindlabua, an interesting little trip into programming and ASCII history!
It is curious, though, isn't it?
+ 2
i have seen it been used on discord for marking sections or parts, and also for compilers
+ 1
To test it on your Android, use termux (the best Linux command prompt, and the best Python interpreter by the way) with hacker's keyboard (the grave accent is obtained long pressing the single quote) and type the command
echo `date`
0
Use 3 of them to print text in JavaScript.
eg;
var text = (```hi I'm a text```);
console.log(text)