Getting Started with the syntax of PACT

This guide is designed for developers who are new to smart contract development. Before diving into writing smart contracts, it’s essential to get familiar with a few foundational concepts that will make your journey smoother.

Functional Programming Basics

A strong understanding of functional programming will be invaluable. If you come from a Lisp background, you’ll feel right at home, as many smart contract languages share similar principles. For those unfamiliar with functional programming, here are some key ideas to focus on:

  1. Immutable Data: Once a value is set, it cannot be changed. This simplifies reasoning about code and reduces bugs.
  2. First-Class Functions: Functions are treated as values, meaning they can be passed as arguments, returned from other functions, or assigned to variables.
  3. Pure Functions: These functions always return the same output for the same input and have no side effects, which makes your code predictable and easier to test.

Writing Your First Functions

Before jumping into smart contract syntax, practice writing simple functions in a functional programming language.