Learn

Five guides that take you from nothing installed to writing real programs. Written for complete beginners, and meant to be read in order.

01

The guides

  1. 01Getting StartedNew to Turf, or new to programming? Start here. This page explains what Turf is, what you need, and the route through the rest of the guides.
    • Know what a programming language and a compiler are, in plain words.
    • Know what Turf is good at, and what makes it different.
    • Have everything ready to install Turf and write your first program.
  2. 02InstallationInstalling Turf takes one command. This page gives you the command for your computer, explains what it does, and helps if something goes wrong.
    • Have the turf command installed and working in your terminal.
    • Understand what the installer did, and how to undo it.
    • Know how to fix the most common problem, turf not being found.
  3. 03Your First ProgramTime to write some Turf. You'll make a program that says hello, find out what every part of it means, and see what happens when something goes wrong.
    • Write a Turf program in a file and run it with turf run.
    • Explain what every line of hello.tr does.
    • Read an error from the compiler and fix it.
    • Make a project with turf new and run a test with turf test.
  4. 04Language BasicsEvery program, however big, is built from a handful of small pieces. This guide shows you each one, with a small program you can run and change.
    • Store values in variables, and know when to use mut or immut.
    • Work with numbers, text and true-or-false values, and convert between them.
    • Make choices with if, and repeat things with while and for.
    • Write your own functions, and use arrays and strings.
  5. 05Tour of TurfYou know the basics. This tour visits the bigger ideas that make Turf what it is, one stop at a time. Each stop explains the idea in plain words first, then shows a complete program.
    • Build your own types with struct and enum, and give them methods.
    • Take values apart with compare, and handle failures with recover and try.
    • Know what references, generics, state machines and modules are for.
    • Know where to read more about each one.
Esc

Type to search.