Operators:
+ addition. Adds or combines
+= add expression1 + expression2
[] intiates NEW ARRAY.
= assigns a value
|| OR
&& And
! not
/ divide
== equal to or SAME AS
> greater then
< less then
// start comment LINE
% calulate the REMAINDER of expression 1 divide by expresion 2
* multiply
() Perfoms a group on one or more parameters
- subtract
++ add 1 more
-- minus 1 more
examples:
(trace variable to see result)
nNum = "Number" RESULT Number
trace (1 + 1); RESULT 2
nNum1 = 3;
nNum1 += 1; RESULT 4
nNum[] = "book1, book2, book3"; RESULT from trace(nNum[0]) book1
nNum = 5
if (nNum > 5 || nNum == 5) { - if nNum is greater then 5 or nNum is same as 5
nNum = 5 * 5; RESULT 25
//nNum = 5; <-- line disabled. passed as a comment
trace (12%5); RESULT 2
i = 1;
i++; RESULT i = 2;
No comments:
Post a Comment