S
Steven Brent
I was wondering why the backticks in the following fragment:
return 'Here's the result: ' + `self.data`
My guess is that in a return statement (as opposed to a print statement)
it's necessary to do this in order to get the self.data instance attribute
as a string, so it can be concatenated with the 'Here's the result: '
string.
What exactly do the backticks do, then? Just return the result of an
expression as a string? Does my guess make sense and / or is it correct?
Elucidations and gentle ridicule welcome.
TIA.
return 'Here's the result: ' + `self.data`
My guess is that in a return statement (as opposed to a print statement)
it's necessary to do this in order to get the self.data instance attribute
as a string, so it can be concatenated with the 'Here's the result: '
string.
What exactly do the backticks do, then? Just return the result of an
expression as a string? Does my guess make sense and / or is it correct?
Elucidations and gentle ridicule welcome.
TIA.