## The Maths Class

### Introduction

You have already met a number of Small Basic Objects – elements within your programming language that package up related methods, properties and other features to help you program. There are many other ‘objects’ available to you and this Topic is about introducing you to some that you will find both useful and interesting.

#### The Maths Class

The Maths class gives us access to mathematical functions that calculate or ‘return’ some very useful values for use to use in our programs. Full blown programming languages usually provide many hundreds of maths functions to perform the most complex calculations but Small Basic has tried to reduce this to a manageable list of really useful ones for you. Most take one or two numbers as ‘parameters‘ and return a result having performed the required calculation.

## Maths Methods

**Properties**

There is only one property for the Math Class and this is a special one in that it is **read-only**. I.e. you cannot change it. It is the value of Pi. Math.Pi always contains the value of Pi – **3.14159265358979**

## The Clock Class

#### The Clock Class

The Clock class gives us access to your computers system clock. Don’t be misled by the name, however, as this class also provides access to date information as well. As computers work so quickly, the clock can not only tell you the hour, minute or second of the day, it ca also tell you the millisecond – 1000th of a second. Using the clock not only tells you the time but also enables you to time your programs or how long it takes for a user to respond to a prompt.

## Clock Properties

## The Sound Class

#### The Sound Class

The Sound class gives us access to sounds and sound effects for your programs. It can be used to provide simple audio feedback or just interest (or annoyance) for your end users. Later I will be introducing an extension object that adds speech capabilities to your programs. This would, for example, enable you to make a speaking clock program.