# 4.1 Variables

Variables can be assigned to hold numerical values using syntax of the form

     a = 5.2 * sqrt(64)

which may optionally be written in longhand as

     let a = 5.2 * sqrt(64)

Variables can subsequently be used by name in mathematical expressions, for example:

     print a / sqrt(64)

Having been defined, variables can later be undefined – set to have no value – using syntax of the form:

     a =

Variables can also hold non-numeric data, such as strings, colors, dates, lists and dictionaries. The syntax for defining many of these data structures is similar to that used by python, for example:

    myList = [8,2,1,7]
    myDict = {'john':27 , 'fred':14 , 'lisa':myList}
    myDate = time.fromCalendar(2012,7,1,14,30,0)

More information about Pyxplot’s data types can be found in Chapter 6.

A list of all of the variables which are currently defined can be obtained by typing `show variables`. Some constants are pre-defined by Pyxplot, and so a number of variables are listed even if none have been set by the user.