The fallowing is the expression view using Readable Expressions from a code block expression.
varresult=1;while(true){if(value>1){result=result*value;value--;}else{break;}}This is the same block used in the loop expression chapter from Microsoft Expression Tree learning
// Creating a parameter expression.ParameterExpressionvalue=Expression.Parameter(typeof(int),"value");// Creating an expression to hold a local variable.ParameterExpressionresult=Expression.Parameter(typeof(int),"result");// Creating a label to jump to from a loop.LabelTargetlabel=Expression.Label(typeof(int));// Creating a method body.BlockExpressionblock=Expression.Block(new[]{result},Expression.Assign(result,Expression.Constant(1)),Expression.Loop(Expression.IfThenElse(Expression.GreaterThan(value,Expression.Constant(1)),Expression.MultiplyAssign(result,Expression.PostDecrementAssign(value)),Expression.Break(label,result)),label));Basically the interpreted code lacks the return statement, which should be like => return result;
The fallowing is the expression view using Readable Expressions from a code block expression.
This is the same block used in the loop expression chapter from Microsoft Expression Tree learning
Basically the interpreted code lacks the return statement, which should be like => return result;