Controlling a motor with a photoresistor/photocell/light dependent resistor

I'm a complete noob on programming. I'm looking for a code that when the light is higher on a photocell/photoresistor/light-dependent resistor connected to an input pin on an arduino, the motor that i have connected to an output pin will spin faster. In other words, a code that reads the photocell resistance ((or "amount" of light coming in) as an input and controls the speed of a motor based on the that value. I know this is probably a really easy task but I'm a complete noob on programming. Thanks in advance!

int ledPin = 13;    // LED onboard Arduino, but you can hook it to your motor
int sensorPin = 0;    // from your sensor

void setup(){

void loop(){
  // need to divide by 4 because analog inputs range from
  // 0 to 1023 
  int val = analogRead(sensorPin) / 4;
  analogWrite(ledPin, val); 
  delay(100); // Hang out for 1/10th of a second