In the autoplay section we are creating a variable, and than a method to return the same value as the variable has. Please explai the logic of this solution. Is there any chance we can pass the value directly without creating a method?
Welcome to our community, and thank you for your question.
Not passing on but you could make the variable public. This way, everything can access that variable and change its value. As you can probably imagine, making a variable accessible can lead to undesired issues, especially in larger projects.
To make our code more secure, we do not allow anything but the instance itself access the variable. Instead, we pass on the value of the variable.