Tcl

From Flooxs
Revision as of 22:53, 30 March 2011 by Nrowsey (talk | contribs)
Jump to navigation Jump to search

All of FLOODS/FLOOPS is built using tcl. A familiarity with tcl commands is essential for understanding how to do anything complex in FLOOXS. You can find many great tcl reference books. We suggest Practical Programming in Tcl and Tk by Brent Welch and Ken Jones. tcl command documentation is also available. Below are some common tcl commands and how to use them.

Common Tcl Commands

set

The "set" command is used to set variables. The syntax is

set variable_name value

All of the variables in tcl are strings. Thus, in the example below, all the variables var1-var5 are strings.

set var1 bunchofletters
set var2 1e5
set var3 1.0e5
set var4 1.0
set var5 1+2

If you type these on the flooxs command line, you'll see that you get back exactly the string of characters you gave. Notice that "1+2" is not evaluated; it is simply a string of 3 characters, the first of which is the character "1", the second of which is the character "+", and the third of which is the character "2".

expr

Since all variables in tcl are strings, we need a way of doing math. This is the "expr" command, which stands for "mathematical expression"

puts

string

list

file

Stuff to Watch out For

brackets in comments

eval set