I can't multiply String like this, ''S'' * 10.
Why does it give error?
Query
Under discussion
Comments (4)
- Popular
- New
- Old
You must be signed in to leave a comment
Thomas
12 October 2022, 06:07useful
* is no valid operator for a String. The only operators you can use on Stirng is + (for concatenation) and . (the dot operator).
So your above code snippet is wishful thinking and you'd have to think about another approach to the problem.
+2
Amber Singh Rathour Pandey
17 October 2022, 13:23
Perhaps it works in another language I studied before.
Thank you for replying.
Have a good day.
+1
Thomas
17 October 2022, 15:41
I've looked into a bunch of programming languages and python is the only one I'm aware of being able to do that.
0
Amber Singh Rathour Pandey
18 October 2022, 17:29
Yes, I studied Python quite a while ago, so it could be that he idea came from there.
Thanks for getting back to me...
0