Tcl (pronounced "tickle" or tee cee ell /
|Paradigm||multi-paradigm: object-oriented, functional, procedural, event-driven programming, imperative|
|Designed by||John Ousterhout|
|Developer||Tcl Core Team|
|Stable release||8.6.8 (Dec, 22 2017) / December 22, 2017|
|Typing discipline||dynamic typing, everything can be treated as a string|
|Filename extensions||.tcl, .tbc|
|PHP, Tea, PowerShell|
Tcl is used a lot to in C to create prototypes quickly. There are interpreters available for many operating systems. This means many different kinds of computers are able to run Tcl code. Tcl is a very small language which means it is good to use as embedded systems.
Safe-Tcl is a form of Tcl that has certain parts turned off so it can't hurt the computer which is running it. Nathaniel Borenstein and Marshall Rose created Safe-Tcl. Safe-Tcl can only work on some files including email messages.
In Tcl programming, empty whitespace separates words. Commands are ended by going to a new line or a semicolon:
word0 word1 word2 ... wordN
The first word is always a command which comes from Tcl's library:
commandName arg1 arg2 ... argN
For example, the commmand puts makes the computer display something:
puts "Hello, World!"
In that example, "Hello, World!" is called a string. Tcl adds a special character which can't be seen at the end of a line. This character tells the computer to go a new line after the command is complete.
Tcl is able to do math and many other things using variables. In order to use a variable, the programmer must set their value:
set variableA 1 set variableB 2
After a variable is set, it can be used in other parts of the program or set to something different. Variables can be used to perform math:
set x 2 set y 4 set ans [expr $x+$y] puts "The answer is $ans." # The computer would show: "The answer is 6."
The command expr tells the computer to solve the "expression" or, in this case, an equation.
setsaves numbers, words, or letters, to a variable. It can also be used to change what is in a variable.
proctells the computer what a new command will do (procedure).
iftells the computer to do what is written only if something is true.
whiletells the computer to do what is written as long as something is true.
foreachtells the computer to something for each item in a list of variables.
breakstops the command from running. This is good to use to get out of a loop.
continuestops the active command, but allows the loop to continue. If the loop is a
whileloop, it will start over. It will let
forgo to the next step in the program.
returnstops the active command and loop, then goes back to the procedure with a value.
- "Tcl/Tk License Terms". Tcl Developer Xchange. Retrieved 2016-11-02.
- "Tcl Dev Kit - Compiler". ActiveState Docs. Retrieved 2016-11-02.
- Lerdorf, Rasmus (2007-04-26). "PHP on Hormones – history of PHP presentation by Rasmus Lerdorf given at the MySQL Conference in Santa Clara, California". The Conversations Network. Retrieved 2009-12-11.
- Windows PowerShell : PowerShell and WPF: WTF
- "Language". Tcl Developer Xchange. Retrieved 2016-11-02.
- "Uses for Tcl/Tk". Tcl Developer Xchange. Retrieved 2016-11-02.
- John Ousterhout. "History of Tcl". Personal pages. Stanford University. Retrieved 2011-08-09.
- "History of Tcl". Tcl Developer Xchange. Retrieved 2016-11-02.
- "John K Ousterhout - Award Winner". ACM Awards. Retrieved 2016-11-04.