Artifact 722e2aa3be875068a828e1a54b2914db40911af1c840f34e5694a079ceccce1e:
- File doc/markdown/introduction.md — part of check-in [704e93c511] at 2026-11-19 22:36:09 on branch tip-700 — forgot to add new introduction.md file (user: Torsten, size: 2941) [annotate] [blame] [check-ins using]
title: Introduction TclVersion: 9.1 Links:
- Tcl Keywords:
- syntax
- notation
- introduction ---
About this manual
This is the manual of the Tcl language and the Tk toolkit. It describes every command available in Tcl/Tk. The manual pages are divided into sections:
- "Tcl" = all commands, functions, variables etc. of the Tcl language
- "Tk" = all Tk commands and Tk/ttk widgets
- "Keywords" = a list of keywords and manual pages associated to them
The basic 12 syntax rules of Tcl ("the Dodecalogue") are defined on the page Language syntax.
Syntax notation
A Tcl/Tk command consists of words where each word is a text string separated by white space from other words. Newlines separate commands (not words).
The first word of a command is called the "command name". The second word of a command, if it is a literal word (see below) is called the subcommand. All other words are called arguments in general. Specific terms are used when an argument serves a specific purpose or is handled in a specific way.
In the manual pages, it looks like this:
::: {.synopsis} ::: [commandName]{.cmd} [subCommand]{.sub} [argument]{.arg} [commandName]{.cmd} [argument]{.arg} :::
Arguments come in two flavours, mandatory arguments and optional arguments:
- A mandatory argument is often just called an 'argument'. As the name says, it is mandatory and cannot be left out when calling the command. It can be a literal word, i.e. something you need to write as presented (like a fixed keyword) or it can be a placeholder for some word you need to write yourself, i.e. variable text.
- An optional argument is often just called an 'option'. Options can be left out when calling the command and typically have a pre-defined default value that applies when left out. Some options take values as an additional word. Those options typically have a '-' prefix (e.g.
-side) and are then written as-optionin the syntax when you can choose any option from a fixed list of possibilities. Otherwise they have the '-' prefix and a literal name to use as is (they are then the only choice to pick from).
[boldText]{.lit} : Denotes a literal word, to be written in the command as is.
[italicText]{.arg} : Denotes an argument. That is a word which is mandatory but with a variable content, i.e. things you must fill in. The text in the syntax description is just a placeholder for your input and its name often tells you what is expected here.
[option]{.optarg} : Text enclosed in a pair of '?' denotes options. These are optional arguments, i.e. words that can be omitted in the command.
[arg]{.optdot}
: Means that the previous options may be repeated any number of times (including zero times). Every word within the enclosed pair of '?' must be repeated in the same order, not just some of them. E.g., [item value]{.optdot} means any number of pairs (including zero) such as item1 value1 item2 value2 item3 value3