(Arduino Uno) Is my code for a follow the sun project valid? We want the motor to stop when both photoresistors have the same amount of light
There are many issues with this code:

pinMode(7,OUTPUT);


What is this pin for? Why do you set it to OUTPUT and then never
actually output anything? If the pin is in use, you should declare a
constant for it, like

const int fooPin = 7;


and then use the constant instead of the bare number 7.

Serial.println(analogRead(RlightPin));   //Write the value of the right photoresistor to the serial monitor.
TranslateAnalogR=analogRead(RlightPin); //Read the right photoresistor value


analogRead() is a slow function, and it is quite inefficient to do the
analog to digital conversion twice. You can instead

TranslateAnalogR = analogRead(RlightPin);
Serial.println(TranslateAnalogR);


As a matter of style, I would remove the comments. Commenting code is
generally considered a good practice, as long as the comments tell
something non obvious, like giving the “big picture” or the rationale
for doing something in a particular way. Paraphrasing in English what
the code already says in C++ is useless.

Serial.println(analogRead(RlightPin));   //Write the value of the right photoresistor to the serial monitor.
//...
Serial.println(analogRead(LlightPin));    //Write the value of the left photoresistor to the serial monitor.


You won't know what value corresponds to the left and what value
corresponds to the right. I would instead do something like:

Serial.print("L: ");
Serial.print(TranslateAnalogL);
Serial.print(", R: ");
Serial.println(TranslateAnalogR);


Then:

if(TranslateAnalogR=TranslateAnalogL){        //If Photoresistor Value is above 355 the motor will stop


You mean ==.

if(TranslateAnalogR=!TranslateAnalogL &amp;&amp; TranslateAnalogR&gt;TranslateAnalogL) { //If Photoreistor R is not equal to L and higher than L move until equal


The first test is redundant. If R&gt;L, then obviously R≠L.

    for (pos=0; pos&gt;=40; pos=pos+1)  {
        myArms.attach(servoPin);
        myArms.write(pos); //send servo to pos
        if(TranslateAnalogR=TranslateAnalogL){
            myArms.detach();
        }
    }


This is a very contrived way of searching the optimum. Normally you
attach the servo once and keep it attached all the time. Then you adjust
the position until you see the same illumination on both LDRs. This way
you keep track of the correct position and you need not redo the whole
angle scan every time. Also, this will not work for three reasons:


You mean TranslateAnalogR==TranslateAnalogL rather than
TranslateAnalogR=TranslateAnalogL
TranslateAnalogR and TranslateAnalogL are not updated within the
loop, you need to explicitly perform an analog read.
The loop will run too fast for the servos to follow the requested
positions.


Later:

    for (pos=0; pos&gt;=40; pos=pos-1){


The loop is backwards. You probably mean

    for (pos=40; pos&gt;=0; pos=pos-1){




Here is my take at this, completely untested:

#include &lt;Servo.h&gt;

// Pinout.
const int PIN_LDR_R = 0;  // right photoresistor 
const int PIN_LDR_L = 1;  // left photoresistor
const int PIN_SERVO = 9;  // servo

const int SERVO_DELAY = 20; // time motor waits before working again

int pos = 90; // servo position in degrees
Servo servo;  // servo object

void setup() {
    Serial.begin(9600);
    pinMode(PIN_SERVO, OUTPUT);
    servo.attach(PIN_SERVO);
}

void loop() {
    // Read and report light levels.
    int level_L = analogRead(PIN_LDR_L);
    int level_R = analogRead(PIN_LDR_R);
    Serial.print("L: ");
    Serial.print(level_L);
    Serial.print(", R: ");
    Serial.println(level_R);

    // Adjust the servo position.
    if (level_R &gt; level_L &amp;&amp; pos &lt; 180)
        ++pos;
    if (level_R &lt; level_L &amp;&amp; pos &gt; 0)
        --pos;

    // Update the servo.
    servo.write(pos);
    delay(SERVO_DELAY);
}


A few things worth noting:


Constants are qualified as const (it helps the compiler optimize and
catch bugs) and spelled in full caps (a common stylistic convention).
The servo position is adjusted step by step, one degree per loop
iteration. No need to perform a full scan every time.
The program does not do anything special when the light levels are
equal, because in that case there isn't actually much to do.
I increased the delay between servo updates to 20&nbsp;ms, as
the serial communication alone can take close to 19&nbsp;ms per
iteration.
You may want to add some hysteresis in order to avoid the servo
jitter when it has found the optimum.