user67917: I am doing a project where, for troubleshooting reasons, I find myself often swapping components to different serial ports. Maybe one time it's in Serial, then in Serial1, maybe I need to try if software serial works.
But changing every line where Serial.print or Serial.write is written for the new port is a hassle and easy to screw up.
Would it be possible to either create a definition at the beginning of the code that lets me rename Serial to SensorSerial so just by changing that definition I am sure it will use the correct port?

user4143: Yes. The simplest way is with a preprocessor macro. Macros get replaced verbatim before compilation happens, so you can do something like:
#define MY_SERIAL Serial

void setup() {
    MY_SERIAL.begin(115200);
}

void loop() {
    MY_SERIAL.println(millis());
    delay(1000);
}


user37622: Majenko's answer is the right answer for your question. But to answer the title of the question, if you ever need to use different Arduino outputs and inputs as variable, most of them have common type Stream or Print. So it would be:
Stream& SensorSerial = Serial;

or
Stream* SensorSerial; 
SensorSerial = &Serial;

The Arduino Stream classes hierachy:


67917: <p>I am doing a project where, for troubleshooting reasons, I find myself often swapping components to different serial ports. Maybe one time it's in Serial, then in Serial1, maybe I need to try if software serial works.</p>
<p>But changing every line where Serial.print or Serial.write is written for the new port is a hassle and easy to screw up.</p>
<p>Would it be possible to either create a definition at the beginning of the code that lets me rename Serial to SensorSerial so just by changing that definition I am sure it will use the correct port?</p>
 4143: <p>Yes. The simplest way is with a preprocessor macro. Macros get replaced verbatim before compilation happens, so you can do something like:</p>
<pre><code>#define MY_SERIAL Serial

void setup() {
    MY_SERIAL.begin(115200);
}

void loop() {
    MY_SERIAL.println(millis());
    delay(1000);
}
</code></pre>
 37622: <p>Majenko's answer is the right answer for your question. But to answer the title of the question, if you ever need to use different Arduino outputs and inputs as variable, most of them have common type Stream or Print. So it would be:</p>
<pre><code>Stream&amp; SensorSerial = Serial;
</code></pre>
<p>or</p>
<pre><code>Stream* SensorSerial; 
SensorSerial = &amp;Serial;
</code></pre>
<p>The Arduino Stream classes hierachy:</p>
<p><a href="https://i.stack.imgur.com/3OV45.png" rel="noreferrer"><img src="https://i.stack.imgur.com/3OV45.png" alt="enter image description here" /></a></p>
