-
Notifications
You must be signed in to change notification settings - Fork 30
Statements
MilleBo edited this page Jan 19, 2017
·
2 revisions
A statement is the smallest standalone element of an imperative programming language that expresses some action to be carried out. Testura.Code provides a couple of different help classes to generate statements:
-
DeclerationStatement
- Declare and assign varilables -
IterationStatement
- Loops -
JumpStatement
- Returns -
SelectionStatement
- If statement -
ExpressionStatement
- Invocation of methods
They can all be accessed through the static Statment
-class.
- Declare
- Assign
- DeclareAndAssign
Statement.Decleration.DeclareAndAssign("testVariable", 1));
var testVariable = 1;
- For (fixed)
- For (references)
Statement.Iteration.For(1, 2, "i", BodyGenerator.Create()
for(inti = 1; i < 2; i++)
{
}
- ReturnTrue
- ReturnFalse
- Return
Statement.Jump.ReturnTrue();
return true;
- If
Statement.Selection.If(new ValueArgument(2), new ValueArgument(3), ConditionalStatements.Equal, BodyGenerator.Create())
if(2 == 3)
{
}
- Invoke
Statement.Expression.Invoke("myClass", "Do", new List<IArgument> { new ValueArgument(1) })
myClass.Do(1);