Setup Pin Mode

  pinMode(13, OUTPUT);     
  pinMode(12, INPUT);
  pinMode(12, INPUT_PULLUP);    //Input with pullup resistor

Set Outputs

  digitalWrite(13, HIGH);
  digitalWrite(13, LOW);

  digitalWrite(13, 1);
  digitalWrite(13, 0);

Read Inputs

Using a variable:

  int MyInputState;
  
  MyInputState = digitalRead(3);
  if (MyInputState == HIGH)
    DoSomething();

Using directly:

  if (digitalRead(3))
    DoSomething();

Analog Pins As General IO

The analog pins can be used identically to the digital pins, using the aliases A0, A1, etc.

  pinMode(A0, OUTPUT);
  digitalWrite(A0, HIGH);

Device Pin Numbers

You should always use Arduino pin numbers (e.g. 1, 2, 3, A0, A1, A2) and not device port pin numbers (e.g. PA0, PA1, PB0, PB1).

Whilst you may get things to work using port numbers, it can trip you up (e.g. ATtiny841 PA pin numbers working but PB pin numbers not)