Quick Introduction

Note:

This introduction assumes that you have previous knowledge about programming and programmatic functionalities. For further information and guidance refer to Till Programming Reference.

Till programming is for everyone! From total noobs who just want to play with a programming language and learn the basics, to most experienced programmers who want to put their knowledge and experience into action with a fascinating language that breaks the boundaries and limitations of other languages.

Let’s go through a mini project that introduces the language in a step-by-step basis. The goal is to calculate π with a famous summation of alternating signed reciprocals of odd integers:

Usually, repetitive actions are put in a looping mechanism. Variables declaration and assignment can be aggregated:

Since higher number of iterations yields more accurate result, it will be efficient to put all calculation activity in a function:

Because we use functions in our code, it is appropriate to create a starting function like the go function, that will be the active function that will run on program start (after running the opening statements section).

Also go is a one-line-function, that includes its one-and-only statement in the same line.

The calc function has one parameter iter_num. The returned value is the last statement of the function.

If it is needed to calculate how much time the program ran, we can use the now system function, which returns a record of current date and time, and has a totalsecond property. Each time, the time record is assigned by now and has the actual total seconds:

Till has a storage module for storing data. Here is a program that stores a list, and on each run it adds a number to the stored list (“\f” denotes the boolean false):

Or get from a database, by using mssqldb module:

Till has a math module that has all mathematical functions, such as math.power, and also a math.pi that is equal to π. So it is possible to make successive calculations with growing number of iterations and check the delta:

It is possible to log program run output with system function “@“. Replacing every print keyword with “@“, will create a file with the extension “.tilldebug”:

A full working program that has all the aforementioned capabilities can be found at Pi Calculator Project.