# Learn 4tH the easy way

We have introduced a new series, in which we will teach you how to program in 4tH. Contrary to most other Forth textbooks (sorry Leo, I didn't mean you!), we won't get as quickly into the internals as possible. Instead, we will try to get you working with 4tH, writing the program you'd want to create. Not to program a handheld device, a robot or an array of LEDs.

You can study the lessons in peace and try out the examples. You don't use 4tH? Why not? It runs on most platforms and is absolutely free! But if you insist you can make your ANS-Forth compiler 4tH-compatible and use this tutorial anyway! So have fun and learn Forth the 4tH way. Maybe you never want to leave. Or you even might be tempted to switch to 4tH!

If you do have any questions, please contact us. We have acquired quite a reputation here, answering most emails within 24 hours.

Level 0

1. Making calculations
2. Manipulating the stack
3. Deep stack manipulators
4. Passing arguments
5. Making your own words
6. Adding comment
7. Text format of 4tH source
8. Displaying constant strings
9. Declaring variables
10. Using variables
11. Built-in variables
12. What is a cell
13. What is a literal expression
14. Declaring arrays of numbers
15. Using arrays of numbers
16. Declaring and using constants
17. Built-in constants
18. Using booleans
19. IF-ELSE constructs
20. FOR-NEXT constructs
21. DO-WHILE constructs
22. REPEAT-UNTIL constructs
23. Infinite loops
24. Getting a number from the keyboard

Level 1

1. Aligning numbers
2. Creating array of constant numbers
3. Using arrays of constant numbers
4. Creating strings
5. Initializing strings
6. Getting the length of a string
7. Printing a string variable
8. Copying a string variable
9. Slicing strings
10. Appending strings
11. Comparing strings
12. Removing trailing spaces
13. String constants and string variables
14. The string terminator
15. Printing individual characters
16. Getting ASCII values
17. Printing spaces
18. Fetching individual characters
19. Storing individual characters
20. Terminating strings
21. Getting a string from the keyboard

Level 2

1. The Character Segment
2. What is the TIB?
3. What is the PAD?
4. How do I use TIB and PAD?
5. Simple parsing
6. Converting a string to a number
7. Controlling the radix
8. Pictured numeric output
9. Converting a number to a string
10. Opening a file
11. Reading and writing from/to a file
12. Closing a file
13. Writing text files
14. Reading text files
15. Reading binary files
16. Writing binary files
17. Parsing a textfile
18. Parsing a binary file
19. The layout of the Character Segment

Level 3

1. The Code Segment
2. The address of a colon-definition
3. Vectored execution
4. The Integer Segment
5. Using values
6. A portable way to access application variables
7. Returning a result to the host program
8. Using commandline arguments
9. The layout of the Variable Area
10. The stacks
11. Saving temporary values
12. The Return Stack and the DO..LOOP
13. Other Return Stack manipulations
14. Altering the flow with the Return Stack
15. Leaving a colon-definition
16. The layout of the Stack Area
17. Booleans and numbers
18. Using ' with other names
19. Assertions
20. Random numbers
21. Time and date
22. What is not implemented
23. Known bugs and limitations

Level 4

1. Conditional compilation
2. Exceptions
3. Lookup tables
4. Interpreters
5. Records and structures
6. Multidimensional arrays
7. Using a printer
8. Fixed point calculation
9. Recursion
10. Forward declarations
11. This is the end