You must memorize vocabulary.
Grammer is about how words are put together into meaningful statements.
Programming syntax is similar to grammer. Sytax is the set of rules (structure and keywords) that must be followed when writing a program. You must understand, memorize, and practice the grammar (i.e. syntax).
In class, we will go over syntax. Take notes and memorize!
If your syntax is incorrext, you will get compiler errors when you try to compile the code. Become familiar with how the computer responds when you have a specific type of mistake so you know how to fix it.
When learning a foreign language, you usually are given short, prepared short conversations in specific scenerios, e.g. ordering a meal in a restaurant, asking for directions on the street. The conversations help you understand and practice how the vocabulary and grammer are used in a typical situation. You must listen to and speak the specific conversation many times until it becomes natural and second nature. [cartoon]
Similarly, in programming, the best way to understand the vocabulary and syntax is to write short programs that do specific simple and common tasks, e.g. prompting the user for their name, or adding a set of numbers. These help you see how the vocabulary and syntax work. You must practice by typing the code into the computer repeatedly until you can do it easily and automatically, without looking at the solution code.
Once you have mastered the specific scenerio (i.e. task), the next step is to slightly vary the scenerio. If you understand the vocabulary and syntax from the specific scenerio, you should be able to figure out what must be changed to fit the slightly altered scenerio. For example, prompting the user for their age, or multiplying a set of numbers.
When you are given a problem to code which is more complex than the above:
[cartoon]
Once you get to know a language, you can read interesting literature, express complex ideas, write letters, poetry, novels etc.
Once you are familiar with the basics of programming, you can design and implement your own software to do things that you want to do e.g. art, music, science, games, etc.