Skip to content

Instantly share code, notes, and snippets.

@Buildstarted
Created January 6, 2012 04:01
Show Gist options
  • Save Buildstarted/1568896 to your computer and use it in GitHub Desktop.
Save Buildstarted/1568896 to your computer and use it in GitHub Desktop.
<pre>@if(someBool){<text>output</text>}</pre>
<pre>@if(someBool){
<text>output</text>
}</pre>
The above items create different output.
Specifically whitespace between { } is maintained when it shouldn't be on the second one.
The expected output for both statements should simply be "<pre>output</pre>".
@Antaris
Copy link

Antaris commented Jan 6, 2012

Lol, alternatively @(someBool ? "output" : "")

@Buildstarted
Copy link
Author

That's an alternative to the specific example of a boolean check but it affects any block level code such as for,foreach and so forth.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment