Share your repls and programming experiences

← Back to all posts
Bug in Variable Declaration and Usage
shikhaahuja2

In this code both code is showing different output but ideally it should show same output

Voters
AmoghTheCool
Comments
hotnewtop
MikeW3
MikeW3
AmoghTheCool

@MikeW3 this explains it better than the others
@shikhaahuja2 it is the correct answer

ch1ck3n

hmm, this is a very intresting bug

this code will solve it, but I'm not sure why it does that

MikeW3
MrVoo

Apparently it thinks the "name" variable is a string :P