In VB/VB.NET, exiting a block of code anytime and anywhere in the code block is handled using EXIT SUB/EXIT FUNCTION/EXIT LOOP e.t.c. I expected RETURN FALSE should work in razor/c# but its not in a function nor sub-routine.its just @{ }.This gets me confused.please, whats the trick or criteria behind this? for example
@{
if(Websecurity.isAuthenticated){
//do something
}else{
json.Write("<li>You must be authenticated</li>", writer);
return false; //this is my line of question
}
//remaining code block
}
第6行是我从剩下的代码块中退出的问题线,就像 VB.NET 或 VB 中的 EXIT Sub 一样。