• Understanding Programming


    Understanding Computers and Programming



    Computers aren't very smart. Sure, they can do a lot of math or help you search the Internet. But, if you asked a computer to vacuum the house for you, could it do it? If you asked a computer to draw a picture of a bird for you, would it? A computer would have no idea about what you're saying.


    Computers are bad at understanding things. If you don't give them exact instructions, they become confused and make mistakes. Telling a computer what you want it to do is sometimes hard because you have to explain things very carefully.


    Because computers don't understand English, you have to give them instructions in special computer languages that computers can understand. This website will teach you the JavaScript language. Most computers understand the JavaScript language.


    Don't be frustrated if you write some JavaScript that a computer doesn't understand. Remember that computers are easily confused, and all the JavaScript instructions have to be exactly right. Computers are very picky! Little mistakes or problems in the JavaScript are called bugs. Even the best programmers make many, many bugs.




    Understanding the Rules of Programming.

    That means that the language has objects that you can give commands to. It's just like in real-life. If you have a dog, you can tell your dog to "sit" or to "roll-over."

    The computer will follow the first command, and then do the next command, and then the next one, until it reaches the end. This list of instructions is called a "program."


    A robot reading a list



    A computer has a memory and can remember stuff. To get a computer to remember stuff, you use variables. A variable is a piece of information with a name for that information.


    Variables: Remembering Stuff

    Large shelves (bookshelf) called "stuff I know" with the number 5 and the "apples" label beside it -- perhaps put it in a large control room?
    Let's say you're shopping for groceries, and you need to buy five apples. You can tell the computer to remember how many apples you need to buy. You can use a variable for this.
    Tell the computer the Number of apples are 5
    So to make the computer understand it you need to write it as
    Apples = 5
    When you run the program, the computer will now store the number 5 in its memory. It will give that piece of information the name "apples."

    Robot looking up shelves for "apples"

    To get the information back from the computer, you simply tell the computer the name of the information that you're looking for. The computer will look in its memory to find that information and give it back to you.



    Variables can be given any name that doesn't have any weird symbols in it. The variable name can have numbers in it as long as the name doesn't start with a number. Here, we have a grocery list of things we have to buy.


    Make sure you spell the variable the same way every time. And make sure you don't mix up your upper case and lower case letters! If you use a variable that the computer does not know about, or if you spell a variable incorrectly, the computer will complain.

    lettuce=2; celery=4; vegetables=6; vegetables = 2+4; vegetables = lettuce + celery; (it's all the same!)
    You can also do math and put everything in a variable. You can even use variables in the math. Look here at three different ways to put things inside of the vegetables variable. They're all the same.



    Suppose a friend is baking an apple pie and asks you to buy two extra apples. To do that, you can just take the old amount of apples that you wanted and add two to it. Then your grocery list will have two extra apples in it.


     apples = 3; show(apples); apples = apples + 2; show(apples);

    One weird thing with variables is that the computer forgets everything each time the program is run. So at the start of the program, you must set all the variables again.(I know you might be thinking the ""Computer"" but can’t remember the variable , How dump)









    Understanding is one thing but explaining it in the real world definition is like doing voodoo stuff
    so basically a definition of the variable would come like " a variable or scalar is a storage location paired with an associated symbolic name (an identifier), which contains some known or unknown quantity of information referred to as a value" Just wikipedia it....

    The variable name is like the address of the house of  the stored value; But you also have to name them.



    Different programming languages have different rule for naming the variables but taking all the common point
    we get this ----

    • Variable names cannot start with a digit (0–9) and cannot contain whitespace characters
    • Many languages only permit the underscore ("_") 
    • Case-sensitivity of variable names also varies between languages
    • In many languages, names beginning with two underscores ("__") 





    THIS IS WANT WE CAN UNDERSTAND ABOUT THE VARIABLES, LET'S MOVE TO STRING ON ANOTHER POST.

    Pls do leave comments.

    --images taken are subjected to their owner right


  • 0 comments:

    Post a Comment

    Powered by Blogger.

    Tags

    Popular Posts