connecting digital pins on two different arduinos?

hey guys, im kind of a noob to all this but:

if i have 2 arduino nanos powered by the same power source,
can i connect the digital pin on one directly to a digital pin on the other and use it to relay a high/low state from one to the other?

would i need any kind of resistor? to prevent too much current?

thanks!

Yes, you can, no other components needed, just make sure both are operating at the same voltage, and you connect the grounds together.

powered by the same power source,

So no need to connect the grounds together if they are the same supply.

Make sure one is initialised an input and the other is initialised as an output.

great! thanks guys