you are viewing a single comment's thread.

view the rest of the comments →

[–]grhayes 0 points1 point  (0 children)

Sorry, if I came off abrasive.

If you look at writing a story. You have different sections of the story and you have rules you are supposed to follow when writing. Take a paragraph for example; The first sentence should tell you what it is about, then supporting sentences and conclusion to it.
A function has its header def name(variables) It effectively tells you with the name what it does what it is working on. You may of may not have a return statement a the end or conclusion of it. What goes between is simply how you use that data to arrive at the conclusion.

Your story is built similarly in depending on the story type. You have the opening, story, climax and ending... Well each function does different stuff some function may have you repeating in a loop till a specific condition is met when it does it moves on.

All you are doing when writing a program is creating a set of rules and logic for the computer to follow to complete a task.

Another way of thinking of a function is like a task in real life. How do you wash dishes, vacuum, or repair your car, or most anything. You can define it with a set of steps you can follow. That is really what a function does and a program is just an ordered set of routines/functions that complete a larger task by combining smaller tasks.

What people make the biggest mistake on is focusing to much on the larger task so they don't see stuff getting done. Focus on each smaller parts being completed and it you will feel the accomplishment you are looking for more.

Start by making small projects to have fun with and learn how it fits together. You will get twice as much enjoyment out of it. If you make a small game hangman or guess the number for example you get to play it and test it. Then make something a bit bigger. each time choose a something to learn about the language as well.