Changing material using an array

I'm trying to get a bit of code working that if a condition is met, it sets a material to a gameobject and if it is not met, it sets a different material. The code I have at the moment is:

var materials : Material[];
public static var Coloured : boolean;

function Update () {
  if (Coloured)
    renderer.material = Material[1];
    renderer.material = Material[0];

However, this returns the error 'Type System.Type does not support slicing'. Can anyone point me in the right direction? (I have set the materials in the inspector).

needs to be

renderer.material = materials[0];

like you named the variable up top