The Way to Jai
A lightweight way to discover and learn the Jai programming language. All programs work with the latest version of the Jai compiler.
This is a work in progress. It grew out of my personal Jai notes from the Jai videos and other Jai primers that emerged over time. If you find mistakes, ambiguities, things that are not clear, please create an issue.
The text is backed by some 300 complete working Jai examples and growing. They are all tested at each new version of the Jai compiler, so this text and code will never get outdated.
Many thanks to Daniel Tan for setting up the Jai-Community and the Jai Wiki. Also thanks to mehlian, seneca, ramin-asadi-2021 and Jakub Arnold(@darthdeus) for their remarks and contributions.
[Text content adapted and code tested to compile/run with Jai version beta 0.1.072]
Table of Contents
0 - Preface
1 - What is Jai?
2 - Setting up a Jai development environment
3 - Compiling and running your first program
4 - More info about the compiler
5 - Constants, variables, types and operations
6 - Bool and number types
7 - Scope of variables
8 - Modules - Structuring the code of a project
9 - More about types
10 - What are pointers?
11 - Memory allocations
12 - Basics of structs
13 - Unions and enums
14 - Branching with if else
15 - Looping with while and for
16 - Types in depth
17 - Basics of procedures
18 - Arrays
19 - Working with strings
20 - Debugging
21 - Memory Allocators and Temporary Storage
22 - Polymorphic procedures
23 - Polymorphic arrays and structs
24 - Operator overloading
25 - Context
26 - Metaprogramming
26B - Macros
26C - Applications of Metaprogramming
27 - Working with files
28 - Inline assembly
29 - Interacting with C
30 - Integrated build system
30B - Manipulating the build process
31 - Working with threads
32 - Working with processes
33 - Graphical(GUI) modules
35 - External modules
36 - Plugins
50 - The guessing game
51 - The game of life
52 - The pong game