I recently inherited a Blazor project and come across many .razor files that are like:
<h1>Some header text></h1>
@if(someCondition) {
<div> lots of html and what not here taking up many lines</div>
} else {
<div> more html taking up many lines</div>
}
What I'm wondering is if there is a syntax that will allow me to eliminate the "else" statements that are hiding in the weeds, by having a return statement in my "if" condition. Meaning:
<h1>Some header text></h1>
@if(someCondition) {
<div> lots of html and what not here taking up many lines</div>
return //JUST BAIL HERE INSTEAD OF HAVING TO START AN ELSE BLOCK LIKE I DO ELSEWHERE IN LIFE
}
<div> more html taking up many lines</div>