Spacing after operators etc (Beginner)

I noticed that there is always space after operator (+) or even the double quotes “…” for strings. Why is this? Also, i have seen no space after ( but the other part of ) has space. I do not understand why it is what it is or what are the rules that govern this?

As for quotes on strings, if there is a space, it will be printed. The space would be there intentionally, for that purpose. If no space is desired, then no space is included.

"string " + "another string"

The first string has a trailing space, the second has neither leading nor trailing spaces. When the two are concatenated (joined into a single string), there will be a space between ‘string’ and ‘another’

"string another string"

As for operators, it is a good practice to surround them with white space so they can be easier to spot.

a * b + c

as opposed to,

a*b+c
2 Likes

hello ,
i have a question please
if there is apps that can create a website for you , then is it still usefull to learn HTML and CSS ?

Perhaps it would be better to learn what you need instead of what you might need. So if you don’t know that you need something, don’t.

1 Like