I'm just now learning c# (my second language, first being python) and i thought it was strange that you could declare variables before ever defining what they are. Here's what I mean:
string str;
//then later, you can do
str = "Bob"
what's the point? is there any logical use case that makes declaring a variable before use the only/best option? Is it faster? Not a big deal, I'm just hung up on this and cant find a cohesive answer anywhere on the internet. Thanks!
(big shoutout to random people online who take their precious time to answer questions of people like me. Really shows character that there are people out there who take time to do stuff like this, so thank you!)
Useful when you are using loops
Now if you did declare the variable inside the loop you won't be able to access it outside.