Yes, after selecting with ctrl-shift anywhere along the line, select the first button in the bottom row of the pet palette that looks like a cube in 3-axes (free 3d movement) - and hold the shift key down as you move and snap to the z-axis (color highlight).
I assume you're doing this to get a SketchUp type learning experience, rather than to actually model a gable roof, which is more accurately/properly done with the roof tool?
One of the forum moderators
AC 27 USA and earlier • macOS Ventura 13.6.6, MacBook Pro M2 Max 12CPU/30GPU cores, 32GB