Welcome visitors of MIC Computer
Welcome to my blog. With this blog you can post your question about computer and programming for absolutely free (free consultation sponsored by MIC Computer).. Well what are you waiting for just feel free to post your question or share with me about your computer / programming experience
Arithmetic Operators
| Operator | Description | Example | Result |
| + | Addition | x=4+3 | x=7 |
| - | Subtraction | x=10-3 | x=7 |
| * | Multiplication | x=2*9 | x=18 |
| / | Division | x=6/2
y=5/2 | x=3
y=2.5 |
| % | Modulus (division remainder) | x=7%2
y=9%3
z=10%4 | x=1
y=0
z=2 |
| ++ | Increment | x=8;
x++; | x=9 |
| -- | Decrement | x=8;
x--; | x=7 |
Assignment Operators
| Operator | Example | Equivalent |
| = | x=y | x=y |
| += | x+=y | x=x+y |
| -= | x-=y | x=x-y |
| *= | x*=y | x=x*y |
| /= | x/=y | x=x/y |
| .= | x.=y | x=x.y |
| %= | x%=y | x=x%y |
Comparison Operators
| Operator | Description | Example |
| == | is equal to | 2==2 returns true
3==2 returns false |
| != | is not equal | 2!=2 returns false
3!=2 returns true |
<>
| is not equal (only at PHP) | 2<>2 returns false
3<>2 returns true |
| > | is greater than | 2>3 returns false
3>2 returns true |
| < | is less than | 2<3 returns true
3<2 returns false |
| >= | is greater than or equal to | 2>=2 returns true
2>=3 returns false
3>=2 returns true |
| <= | is less than or equal to | 2<=2 returns true
2<=3 returns true
3<=2 returns false |
Logical Operators
| Operator | Description | Example |
| && | and | x=2
y=3 (x < 5 && y > 2) returns true |
| || | or | x=2
y=3 (x < 1 && y > 2) returns true |
| ! | not | x=2
y=3 !(x==y) returns true |
As an programming language that support OOP, Javascript also have procedure and function. Procedure and function on javascript has the same format like PHP and any other C++ style language.
function procedure_and_function_name(var1,var2,...,varX)
{
javascript code
}
As you can see procedure and function format has the same format. The different is function has a statement like this:
Return(variable_or_value);
here is some example:
Example of procedure:
function message(message_contain)
{
alert("This is my message "+message_contain);
}
Example of function:
function message(message_contain)
{
return("This is my message "+message);
}
echo(message("Hello friend"));
Hope this can help you
Every object oriented programming (OOP) should need a procedure and function. PHP is also OOP so it also need procedure and function. To declare a procedure or function, we have a same format
function hello(message)
{
echo(message);
}
the above example is a PHP procedure. Althougt you see that the declaration is function :). This is the example of PHP function.
function hello(message)
{
return("my message is " . message);
}
this is a PHP function, can you see the different? Yes you are right. The different is there is return statement as a return value on PHP function. That's all..