I noticed that if I leave off the terminating double quote for a string constant in Visual Studio 2010, there is no error or even a warning, i.e.
Dim foo as String = "hi
However, the continuous integration tool we are using flags an error:
error BC30648: String constants must end with a double quote.
What’s going on here? Is there some language rule in VB.Net that makes a terminating double quote optional “sometimes”? Is there some setting in Visual Studio that will make it flag this as an error, so I can avoid “breaking the build” in this way?
Actually, historically, the BASIC language never REQUIRED a closing quote. This dates back to the 70’s. GW-Basic, BasicA, QBASIC, QuickBasic, even older Tandy and TRS-80 computers NEVER required a closing quote. This is nothing new. The reason for this is because BASIC is not a free flow language, like C or C#. This means that whenever a newline is found, BASIC knows that your string must end, quoted or not. Microsoft has purposely not enforced this rule in order to be compatible with older code.