I take it you are talking about Arduino analogWrite?
If so I'll save you the trouble of just Googling it and tell you that they are very different, so just use digitalWrite unless you know that you really need analogWrite. analogWrite sends a pulsed output via the PWM pins and so can be used to dim an LED or passed through a filter to produce a voltage other than the digital high voltage.
It would be good if you mentioned that this is for an Arduino, as some may be confused with undefined language such as "digitalWrite".
With that said, the Arduino website helps and is the first result when searching for those exact terms:
As you can see from the documentation, analogWrite is a Pulse-Width Modulated (PWM) signal, where digitalWrite produces a constant HIGH or LOW.
by Duane Benson
by Duane Benson
by Aaron Carman