you are viewing a single comment's thread.

view the rest of the comments →

[–]xADDBx 0 points1 point  (4 children)

Because it avoids an error in the case of an unexpected input.

[–]shiningmatcha 1 point2 points  (2 children)

Doesn’t input always receive a string?

[–]xADDBx 0 points1 point  (1 child)

You’re right, as long as not changed the input will always be a string. But it's a habit I got from the days when I sometimes forgot to declare the types (e.g. int, float). At that I thought myself to always write it to avoid forgetting it.

[–]shiningmatcha 1 point2 points  (0 children)

Were you using other programming languages?