Why can I add characters to strings but not characters to characters?

前端 未结 7 816
陌清茗
陌清茗 2020-12-21 09:18

So I wanted to add a character to a string, and in some cases wanted to double that characters then add it to a string (i.e. add to it itself first). I tried this as shown b

7条回答
  •  無奈伤痛
    2020-12-21 09:58

    Adding in the "" changes the return type to a string. Leaving it out means the return type is a char which doesn't match.

提交回复
热议问题