Warning: Assignment Variable

Can someone explain me what the warning means? If anyone has tips for preventing this error then it would be awesome.


user_input = "Sam is mad!"

while user_input != "END"

    print("Enter some input, or END to quit: ")

    user_input = readline() #prompt the user input


error code:

ā”Œ Warning: Assignment to `user_input` in soft scope is ambiguous because a global variable by the same name exists: `user_input` will be treated as a new local. Disambiguate by using `local user_input` to suppress this warning or `global user_input` to assign to the existing global variable.

ā”” @ *:\+++++++++++(Privacy)\While loops.jl:5


1 Like