Skip to content

Commit

Permalink
add args handling to [for]
Browse files Browse the repository at this point in the history
  • Loading branch information
coke committed Nov 30, 2009
1 parent 11e9695 commit 9dc018b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/PmTcl/Commands.pm
Expand Up @@ -125,7 +125,15 @@ our sub expr(*@args) {
&sub();
}

our sub for ($init,$cond,$incr,$body) {
our sub for(*@args) {
if +@args != 4 {
error('wrong # args: should be "for start test next command"');
}
my $init := @args[0];
my $cond := @args[1];
my $incr := @args[2];
my $body := @args[3];

eval($init);
while expr($cond) {
eval($body);
Expand Down

0 comments on commit 9dc018b

Please sign in to comment.