my first 'sketch'. Potentiometer controlled RGB

Hi everyone! I just finished my first Arduino sketch, I’m pretty excited about it. I am working towards having it fade, hence the RGBR. I know there is a code that does this already but I wanted to write it myself so that I could learn.

int potpin = A0; //potentiometer in port 0
int rpin = 9; //red LED pin
int gpin = 10;//Green LED pin
int bpin = 11;//blue LED pin
int sensorValue =0;

void setup(){
  pinMode(9, OUTPUT); //red
  pinMode(10, OUTPUT); //green
  pinMode(11, OUTPUT); //blue

void loop () {
  sensorValue = analogRead(potpin); //read value from pot
  if (sensorValue < 255) { digitalWrite(rpin, HIGH); //turn R on
                           digitalWrite(gpin, LOW);  //turn G off
                           digitalWrite(bpin, LOW);   //turn B off
  if (sensorValue < 510) {digitalWrite(gpin, HIGH);//turn G on
                          digitalWrite(bpin, LOW); //turn B off
                          digitalWrite(rpin, LOW); //turn R off
  if (sensorValue < 765) {digitalWrite(bpin, HIGH);//turn B on
                          digitalWrite(rpin, LOW);//turn R off
                          digitalWrite(gpin, LOW);//turn G off
  if (sensorValue <1024) {digitalWrite(rpin, HIGH); //turn R on
                          digitalWrite(gpin, LOW);  //turn green off
                          digitalWrite(bpin, LOW); //turn blue off