we can’t perform mathematical operations on strings, even if the strings look
like numbers, so the below example would not work:
'fruits'-'vegetables' 'bread'/'easy' 'egg'*'b clean'
But there are two exceptions, + and *.
The + operator performs string concatenation, which means it joins the strings by linking
them end-to-end. For eg:
> first = 'fruits'
> second = 'vegetables'
> first + second
fruitsvegetables
The * operator also works on strings; it performs repetition. For example, 'fruits'*2 is
'fruits'.
Note:Here one value is string and another one is number.
Comments
Post a Comment