153k views
1 vote
Local variables declared in the body of a while loop are only accessible within the loop body.

True
False

User Ajeetdl
by
8.2k points

1 Answer

3 votes

Final answer:

Local variables declared within a while loop are accessible only within that loop and not outside of it; this statement is true.

Step-by-step explanation:

The statement that local variables declared in the body of a while loop are only accessible within the loop body is True. Variables declared inside a loop are considered to be local to that loop, which means they can only be accessed and used within the confines of that loop. Once the execution of the loop is completed and the program exits the loop body, these variables cease to exist and hence are not accessible outside their scope.

User Fhdhsni
by
7.5k points