When setting up question logic you may notice an option to Save this question's data if hidden after initially shown that appears after setting up your logic conditions. This applies to how you wish to have data handled when respondents move back and forth in the survey.
For example, in the below survey we have two questions; the second question shows if the first question's answer is Yes. As you can see, it is possible for a survey respondent to change their answer to the first question after answering the second question thus making the second's question data off-path in terms of logic.
By default, off-path data is not stored, however, you can select the option to Save this question's data if hidden after initially shown and this data will be stored!