Messaging Apps powered by Machine Learning

Pez supports a number of standard types as literals. In addition to the standard literals, pez also supports some non-standard literals.

  • integers,
  • floats,
  • booleans,
  • strings,
  • dates,
  • datetimes,
  • urls.


Integers are just like their mathematical counterparts and represent both positive and negative whole numbers. Here are examples of integers:

  • 1
  • -5
  • 2894817301493

Integers can be used in any mathematical operation and will always return an integer. The results are to be expected, except with division.

If this is not the behavior you want, you should use floats.


To represent fractional values, a float must be used. The word “float” is an abbreviation of floating point number. Floats are formed using American style decimal numbers, i.e. a period is used to distinguish the whole from the fractional component. The following are all valid floats:

  • .4,
  • -0.5,
  • 225.90237.

Notice that a leading 0 is not necessary when creating a float.

Combining integers and floats in an operation yields a float. Compare the below operations with above. If this is the behavior you want, be sure that at least one operand is a float.

We won’t get into all the gory details about how floats represent decimals since there is plenty of literature on this subject. What you should be aware of is that not all decimal values exist in a floating point representation, and when dealing with high precision, you need to be careful.


Logical values are called booleans, and by definition there are only two of them: true and false. These values are literal and entered into the interpreter as is. Note that due to an implementation detail, the result of true and false are capitalized versions of themselves. In pez, always use the lowercase literal values.

Pez supports the standard logical operations on booleans. These are

  • not,
  • andalso,
  • orelse.

For example, the following expression evaluates to true.

The operators andalso and orelse have a lineage in programming languages that pez follows. In latter sections, it will become clear why they are named as such as opposed to the more concise ‘and’ and ‘or’.


A string is short for character string and represents free-form textual data. Basically, anything wrapped in single or double quotes is a string.


How a language handles dates can separate a convenient language with an annoying language. In pez, the goal is to simplify how dates are handled. Using the ISO 8601 format ‘yyyy-mm-dd’, dates can be specified literally. So instead of calling constructors and passing strings, you just write the date. Feel free to rejoice.

Obviously not all dates can be specified literally. For this scenario and also for non-standard date formats, the date constructor can be used. This supports most string formats.


A datetime is like a date but also includes time information. These can also be specified as literals.

The null type

A special value is null, which is computer-speak for “no value”. A null can be assigned to a variable and can also be used as a literal in a data structure.

What’s Next

Read about data structures in pez.