This tutorial uses JavaScript Language to demonstrate the underlying concepts.
1) Computer basically performs three basic tasks:
1a) Input values from user.
1b) Process input values.
1c) Output results back to user.
2) A simple output statement.
2a) The following is a simple output statement.
2b) See the output here http://ideone.com/JwDA2B.
2c) This program output values that have been set before the run time. It is also called "hardcoded", i.e the value is fixed throughout the run time.
3) A simple processing statement
3a) The codes in (2) have been modified to include some data operations.
3b) See the output here http://ideone.com/Et6f4O .
3c) The codes show the sample of data operations involving String data type and Number data type.
3d) The initial values of the data are still hardcoded.
4) A simple input-process-output statements
4a) The codes in (3) have been modified to include variable declaration, initialization and input statements.
4b) See the output here http://ideone.com/l3SVWQ .
4c) The codes shows the data input and data operation (string and number). Data that holds input value is commonly called VARIABLE. In this example, username is STRING VARIABLE and firstnum and secondnum are NUMBER VARIABLE.
4d) Notice that the "+" data operator works according to the context of data types ( for STRING VARIABLE, '+' means concatenate and for NUMBER VARIABLE, '+' means mathematical add operation.)
4e) Notice that the use of variables makes this program dynamic, i.e it can take input values during run time. In this examples, the variables are said to be "softcoded".
No comments:
Post a Comment