Correct! lines that have undefined slopes are always parallel to the y-axis as the change in x is 0. A gradient is calculated by the change in y divided by the change in x and anything divided by 0 is referred to as undefined.

(calculation for a gradient)
Hope that helps sorry if its a bit confusing :)