or
निरंजन
I was getting one error (i.e. ! Missing number, treated as zero.) which I found irrelevant. I checked the brackets many a times and I think I am right at them. My question is why is \\ good for the first line, but not good for the second line? Also replacing \par with a blank line gives the exact result that I want, but why \\ doesn't work? The code is as follows -


\documentclass{article}
\setlength{\parindent}{0pt}

\begin{document}
[abc]\\
def\par%\\
[ghi]\\
\end{document}

Your issue has nothing to do with LaTeX's math typesetting or the material you put in math mode. A minimal non-working example to this looks like the following:

tex
\documentclass{article}

\begin{document}
[abc]\\
[def]\\
[ghi]
\end{document}


The issue is that \\ takes an optional argument, and while parsing for that argument spaces are ignored, so the above is equivalent (for LaTeX) to:

tex
\documentclass{article}

\begin{document}
[abc]\\[def]\\[ghi]
\end{document}


What happens now is that \\ takes the optional argument (def in the first and ghi in the second case) and tries to use that optional argument, which should specify an additional vertical space inserted after the linebreak, as a correct dimension. So TeX begins to parse def as a dimension, finds that this is not a valid skip or dimen register and parses for a valid float followed by a valid unit, hence throwing the missing number error.

To solve this you have to "hide" the [ as the opening delimiter of the optional argument. You can do so by putting a \relax after \\:

tex
\documentclass{article}

\begin{document}
[abc]\\\relax
[def]\\\relax
[ghi]
\end{document}

It certainly is wrong however if used at the end of a paragraph.
it's not ultimately wrong in every case, just in most cases. It's one of those very wide spread novice errors.
Yes, I agree. if it is wrong, it should produce errors.
I didn't know this. Thanks.
IMHO, LaTeX should make \\ throw an error if used outside a few specialised environments.
Also, considering the MWE, \\ should never be used at the end of a paragraph (which is the case after [ghi]). You may want to remember that \\ is meant to *separate* two lines rather than to just end a line.
I have updated the question for future readers.
Ah! When I was making an MWE I wrote abc\\def\\ghi without the brackets. I didn't understand that it is giving errors because of the brackets. Thanks for your explanation :)
That happens if you don't read the question completely... Sloppy me.
@निरंजन Ah, I guess you tried to run it without the comments before the \\... I'll post an answer.
@निरंजन are you sure this is the code throwing errors for you? It works without problems for me.