2 ms·
Yeah I know, but there's a wide range of languages which are neither C nor Rust. My point is, there are plenty of examples of languages that show that you don'
by skohan 7y ago
Yeah I know, but there's a wide range of languages which are neither C nor Rust.
My point is, there are plenty of examples of languages that show that you don't need to add semicolons to almost every line of your program just to avoid this one potential error.
- leshow 7y agoOut of curiousity, which languages are you referring to? Assignment in if-statements is possible in C, C++, js, Go, and many other C-like languages. I think the only language I know of that disallows assignment in them is python, and it's not because assignment evaluates to something other than boolean, python is happen to evaluate the 'truthiness' of certain types. And funnily enough, they are going to add this back in to python 3 I believe, using a different operator.
- skohan 7y agoSwift, Kotlin, D, C# to name a few. Are you sure about Go? I just tried this in an online playground, and I get this error: syntax error: assignment x = 2 used as value