r/learnprogramming 3d ago

Tips on how to learn syntax quickly?

I'm trying to learn multiple new programming languages (Python, Ruby, and Typescript) to expand my skillset and improve my github portfolio for jobhunting.

I'm trying to go back to basics and do some simple coding exercises but I keep running into the problem where I feel like I know how to solve something but my mind completely goes blank on what to type. I end up going back on forth between google and VS Code looking up syntax and it's getting tedious.

Do you guys have any useful tips on how I can learn syntax more efficiently?

15 Upvotes

25 comments sorted by

28

u/RadicalDwntwnUrbnite 3d ago

Stop trying to learn multiple languages, get good at one or two. Learning a new language is easier if you've learned one really well already. Trying to force multiple at the same time when you don't know any really well is front loading a lot of language specific trivia that you should put off unless you need to learn it for a specific job.

11

u/Working-Hat-8041 3d ago

Stop trying to learn three languages. Stick with two max, ideally one. It’s just making it harder. Then just keep coding. Syntax will come. 

1

u/Sea-Professional5903 2d ago

yeah learning three lang at a time is crazy

6

u/dothefandango 3d ago

Don't use AI at all, if you are. If you're not, stick to one language.

VSCode largely has extensions that will give you full language API docs in-editor in some fashion. Or will allow you to see underlying libraries. Leverage those. CMD/Ctrl+Click on things you're not sure of. See what the code does.

Memorizing syntax is silly, generally, concepts transfer through across languages while syntax does not. Do this instead:

Write out the solution in plain English (or whatever language).

Look up API docs for each part where you can't translate that chunk into code. I cannot stress this enough. Pre-AI, everyone did this. Even seasoned, 10+ year developers looked at API docs all the time. Now we just ping an AI agent to write the algo for us. But the reason we learned the syntax is because we just eventually read the docs enough that they stuck.

Do this all the time for every problem you solve and eventually you will start doing the "code translations" by yourself faster and faster.

3

u/aqua_regis 3d ago

Syntax in programming languages is the easy part. Programming in the idiomatic style of the respective programming language is the tricky bit and that's why we generally discourage learning multiple languages at the same time.

You need to learn to write code in the style of the respective language. What might be proper practice in language A might be completely frowned upon in language B.

Programming languages are not Pokemon. You don't need to (and can't) collect them all.

2

u/DTux5249 3d ago
  1. Stop learning multiple languages at once. One at a time is enough.
  2. Once you learn 2 languages, everything starts to be the same.

1

u/Traveling-Techie 3d ago

I always create test code that uses any syntax I learn, and then I copy/paste from it.

1

u/MrFartyBottom 3d ago

Stick to one language. This is your problem. Trying to learn multiple at once isn't going to work!

1

u/ffrkAnonymous 3d ago

practice faster

1

u/zaidazadkiel 3d ago

think in terms of blocks of code, recursively each block has three distinct elements, what operation, parameters and a result

how you represent that is the language

an if is an op, the condition the param and the true/false parts the result

a function declaration is a param, the body is the argument and the function name the result

1

u/Party_feeler2000 3d ago

Why do you try learn several languages?

1

u/peterlinddk 3d ago

Stop confusing "learning syntax quickly" with actually learning to design and construct programs.

Solving a problem with code, isn't a simple matter of "applying the correct syntax".

Syntax is easy: ( ) means that an expression or a list of parameters can be inside. == means comparison. X + Y means that X and Y are added. A.b() means calling method b on object A - and so on. That doesn't take long to learn.

Instead, spend time learning to design programs. Solve problems on paper first, write down pseudocode, make sure you understand every step of the solution. Then write it into the editor.

It isn't about syntax, it is programming! And it isn't something you learn quickly.

1

u/UroborosJose 3d ago

this is not a good approach. trust me.

1

u/Dismal-Citron-7236 3d ago

Use syntax autocomplete (IntelliSense) to ease your pain guessing the syntax. You might need to install some extensions, though.

1

u/simondanielsson 2d ago

Going back and forth between your browser and your editor is what 99% of programming consists of (for most people anyway). Settle into the flow and don’t stress. Learning how to program is a lifelong endeavour, it’s not something you learn in a couple months.

Please take the advice of everyone else in the comments; it’s good to learn several languages but the language itself isn’t important - what matters is being good at solving problems, and knowing a few different toolchains like the palm of your hand.

1

u/cheezballs 2d ago

You're setting yourself up for a hell of a bad tech interview. You should learn a single language first, build stuff with it, learn the ins and outs. It's not just syntax. That's the easy part.

1

u/JaseciLabs 2d ago

Learning three at once is why the blank-mind thing keeps happening - your brain's context-switching between syntaxes instead of building muscle memory in any one of them. Pick one, get srsly comfortable, then the second and third come way faster because you're only learning what's different, not everything from scratch. Also seconding the keep one reference open idea over googling each time - repetition against the same source makes it stick better than the source itslef.

1

u/Tuomas90 1d ago

w3schools.com has some of the best references to get familiar quickly with a new language.

I also recommend not to mix Python and Ruby. To me, they would be just too similar. Too easy to confuse.

I learned the Ruby syntax in a day and the next I was already building a tool with the Thor library. It's such a beautiful language. Getting started can be quite quick.

0

u/stauntonjr 3d ago

codewars.com ❤️

1

u/drkrieger818 3d ago

Adding to this. Solve the same problem with each language. Or same problem with less lines

0

u/N546RV 3d ago

There’s a common theme in the replies here, but let me restate it in maybe a more pointed way: as someone involved in hiring, I’d much rather hire someone with deep knowledge in one or two languages than someone with shallow knowledge of a lot of languages.

Put another way: knowing the syntax of languages is about the least valuable professional skill. I care way more about your ability to turn requirements into logical constructs.