8

I'm learning Tcl. In Perl I can do this:

 $ perl -e 'for ($i = 0; $i < 5; $i++) { printf("name%03d\n", $i) }'
 name000
 name001
 name002
 name003
 name004

Can I do this in Tcl?

1 Answer 1

30

See format:

$ tclsh
% for {set i 0} {$i < 5} {incr i} { puts [format "name%03d" $i] }
name000
name001
name002
name003
name004
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.