Guide
Console
Tour
Words
Stack
Word-types
Data-types
Structures
Scopes
GUI-Toolkit-Tk
Tcl-Literature
Engine
Objecttypes
Compiler
Applications
Postfix

TclForth Tour

A first view on the console and the command line. - TclForth changes the standard Forth command line just a little:

----
Strings need no space after the first "

``` "Hello World"
({Hello World}) ok
. cr
Hello World
ok
```
The command line evaluates immediate words.

``` 7 0 do I . loop
0 1 2 3 4 5 6 ok
ok
```

[Stack](Stack.md) diagrams are enclosed in braces.
```
: Star { -- } "*" . ;
ok
Star
* ok

``` Stack parameters are local variables.

``` : Stars { n -- } n times Star repeat ;
ok
5 Stars
* * * * * ok
: Grid { n m -- } n times m Stars cr repeat ;
ok
3 4 Grid
* * * *
* * * *
* * * *
ok
```
Say, you want to print the stars without trailing spaces: simply redefine Star and keep the later words Stars and Grid. {} denotes an empty stack.

``` : Star {} "*" ascii emit ;
ok
3 4 Grid
****
****
****

``` Tcl replaces code in a loaded word. The change is active for all dependent words. - You can change a running TclForth program.

TclForth makes good use of the variable substitutions in Tcl.

``` 33 variable V
ok
"The value of V is $V" . cr
The value of V is 33
ok
```

Work on the GUI: Add a command to the help menu.

``` : SayHello {} "Hello TclForth!" . cr ;
ok
"Hello!" {SayHello} hMenu addcommand
```
And try it.

Enjoy TclForth!