Why does coding work?

Well, when you are coding in c+ or python or whichever language, you are essentially giving commands to a sub system operator. It goes down to the base level program, called machine coding, that is basically a set of switches. Binary, represented as 1 and 0, is a series of the switches being either opened or closed. An open switch '0' is an ended electrical circuit and the flow stops at this point. A '1' is a closed circuit that allows the current to continue down the path. You can see these simple representations on many power buttons. The circle with the line coming down the middle. 0 = powrr off. 1 = power on. When you are writing code you are setting a series of switches to be opened or closed to make direct path for electricity to complete a circuit. It would be like having thousands of light switches connected together to power bulbs. You'd need to make sure each switch was in the proper open or closed setting to direct the electrical current to the light bulb. Now add thousands of lights each controlled by the same set, or series of sets, of switches. When you type code, you write a series of on/off commands, (typically 'if/then') that influence which bulb or bulbs received power.

If that isn't quite what you asking, you could think of it as adding missing instruction. If you want the screen blue but there isn't a built-in function to make it happen then you would a command to tell the computer to do it.

Hope some of this helps.

/r/askscience Thread