Skip to content

Conversation

@sitskomickhail
Copy link

No description provided.


public IEnumerable<ICommand> Compile()
{
var realBody = _body.Concat(_increment.Concat(new ICommand[]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use while class, not copy it

private readonly ICommand[] _increment;
private readonly ICommand[] _body;

public ForCommand(ICommand[] condition, ICommand[] body, ICommand[] increment)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For loop can be a bit more complex:
for(int i = 0, j = 10; i < 10 && j > -5; i++, j--) {
body
}

So there also should be a definition block that should be executed once, before loop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants