4 ms·
Ask HN: Confusing Ruby and JS syntax while programming?
I'm pretty new to web dev. Doing Ruby/JS but I tend to forget which one I'm in and swap syntax and styles.
Is there a good method or tools to more easily keep these two modes separate? Or is this a newbie thing that improves as I get more experienced?
- roopeshv 14y agoStyle is something you'll get with practice, and deliberate attention to the process of writing code. Syntax on the other hand, is very different in Ruby and JS. I'm not sure what exactly you are confusing specifically. I switch between Python and Ruby for the most part, and I find Rb/Py to be very close in syntax, than Rb/JS. So between Rb/Py I mostly confuse the if/elsif statements more than anything else, and refer to python manual from time to time. If you point to specifics, may be we can discuss more about what is confusing and how to avoid it.
- TazeTSchnitzel 14y agoI personally often end up confusing CoffeeScript and Python.
- swah 14y agoThe obvious solution here is to write a compiler :)
- rkwz 14y agoI haven't noticed such a thing. I used Java, Ruby and JS in my previous project but I don't remember being confused. Maybe it's a newbie thing. Anyway, Ruby's syntax has underscores (snake_case) and JS has lowerCamelCase style syntax. Hope it helps! :)
- jyu 14y agoMaybe confusion is the wrong word. But just making mental lapses like forgetting semi-colons or adding unnecessary brackets and underscores, that kind of stuff.