use the <text> tags
@{ var foo = true; }
@if(foo) { <text>Yes</text> } else { <text>No</text> }
The <text> tag signals to the razor view engine to write the contents to the output.
Alternatively, you can use @:
@{ var foo = true; }
@if(foo) { @:Yes } else { @:No }