Lessons
Tcl · Introductory
Tcl · Introductory. Ten lessons. Open-book quizzes. Lesson 1 free.
10 lessons · The Host · Lesson 1 free
Pass all ten lessons for the certificate. Sample · Claim

Lesson 1 · On the house
Hello, Tcl: commands, words and set
Run scripts with tclsh, read every line as a command made of words, store values with set and print them with puts.
![Substitution and quoting: $, [ ], "" and { }](/lessons/tcl-2.webp)
Lesson 2
Substitution and quoting: $, [ ], "" and { }
Tcl substitutes variables, commands and backslashes once per word. Quotes group and substitute; braces group and keep text literal.

Lesson 3
Numbers: expr, incr, append and format
Do arithmetic with braced expr, see integer vs double division, use maths functions, update variables with incr and append, and format output.

Lesson 4
Control flow: if, for, foreach, while and switch
Branch with if and switch, loop with for, foreach and while, and leave or skip iterations with break and continue.

Lesson 5
Procedures: proc, defaults, args, upvar and apply
Define commands with proc, add default and variable arguments, reach caller and global variables with upvar and global, and run lambdas with apply.

Lesson 6
Lists: build, index, sort, search and map
Make lists with list and lappend, read them with lindex and lrange, sort and search them, convert with split and join, and transform with lmap.

Lesson 7
Strings: the string command, regexp and scan
Measure, slice, search and replace text with string subcommands, validate values with string is, and match patterns with regexp and regsub.

Lesson 8
Dicts: key-value data
Create dicts, read and test keys, update them in place with dict set and dict incr, walk them with dict for, and nest and merge them.

Lesson 9
Arrays, namespaces and info
Store tables in array variables, test elements with info exists, group code with namespace eval and variable, and build subcommand ensembles.

Lesson 10
Errors and files: catch, try, throw and channels
Raise errors with error and throw, handle them with catch and try/trap/finally, and write and read files through channels.
Sample certificate
Certificate of completion
Sign in to claim your certificate of completion.
Certificate
Finish all ten lessons, then sign in
Pass every lesson on this device (quizzes and checks). Then sign in or create an account to type your name and download the JPG.