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.
\(\frac{y_{1}- y_{2} }{x_{1}- x_{2} }\)
(calculation for a gradient)
Hope that helps sorry if its a bit confusing :)