Hello Natalia
Yes, if you purchase a standard point-to-point ticket. It is good to travel on any train on the day of validity, and it allows intermediate stops along the line yet no backtracking.
Alternatively you could purchase a Saver Day Pass for unlimited travel on the Swiss public transit network.
Kind regards,
Roland