All Product ->
Home
Part 1 - Working With Data
1 - Hello World
2 - Booleans
3 - Numbers And Strings

Hello World

To use FTD language we have to use FPM the package manager and server for FTD.

In this exercise we will install FPM, and run a hello world program.

Understood
Lesson 1: Install FPM
To install fpm we will use the installation script:
install fpm
sudo sh -c "$(curl -fsSL https://raw.githubusercontent.com/ftd-lang/fpm/main/install-fpm.sh)"

This installs fpm in /usr/local/bin/fpm. If you are curious this is the source code of fpm-install.sh.

Alternately, you can go to the FPM Releases Page and download the fpm binary for your platform from the latest release as well.

We support recent versions of Linux, Mac and Windows.

To test if the installation worked, run:

run fpm to see if its working
fpm

And it will show you the fpm help text. Shout out to let everyone know when you are done with this step.

If you get an error message in chat or speak up.

Done
Task 1: FPM.ftd

Note: If you have not yet cloned ftd-lang/ftd-workshop repo as mentioned in workshop basics, please do it now: git clone https://github.com/ftd-lang/ftd-workshop.git.

FTD files are organized in FPM as a “fpm package”. This is like npm package for JavaScript or cargo crate for Rust.

A FPM package is a folder containing a file named FPM.ftd and some FTD files.

If you run fpm serve right now and go to http://127.0.0.1:8000 it will fail with message in terminal saying FPM.ftd file is missing.

Lets fix this by creating a FPM.ftd file with the following content:

sample FPM.ftd file
-- import: fpm

-- fpm.package: hello

We have “imported” fpm, a special ftd module (each ftd file is called a fpm module, the way we call .py files python modules).

We have created an instance of fpm.package and passed hello as the name of the package.

Now if you run fpm serve it will pick up FPM.ftd and when you go to the server address (http://127.0.0.1:8000 by default), you will see an empty page.

Congrats, you have created your first FPM package!

You are Done

You have installed fpm and created your first fpm package. Good job!

Move to learning about booleans now or back to the workshop page.

Need Help?

Please join our Discord to ask any questions related to this workshop!

Or just meet the others who are learning FTD like you :-)

ℹ️
Github Repo
The code for this workshop can be found on Github: ftd-lang/ftd-workshop.
Join The Next Session
The next remote workshop would be happening on 4th Nov 2022. Learn more here.