Created
August 3, 2021 18:41
-
-
Save Gabbrolee/002b479428da6210d3ed57f26c223609 to your computer and use it in GitHub Desktop.
DAY ONE : OPERATORs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//MARKS:- OPERATORS: These are the little symbols we learnt in our arithmetics | |
var a = 10 | |
a = a + 1 /* top up the value of a with 10 and it will make it 11 | |
a = a - 1 reduce the current value of a by 1 and it will make it 10 | |
a = a * a multiply the current value of a by itself and it will make it 100 */ | |
var b = 10 | |
b += 10 // b is now 20 | |
b -= 10 // b is now 10 | |
var c = 1.1 | |
var d = 2.2 | |
var e = c + d // this will add the decimals together and gives 3.3 | |
var name1 = "Tim McGraw" | |
var name2 = "Romeo" | |
var both = name1 + " and " + name2 // Tim McGraw and Romeo | |
var m = 9 | |
var f = 2 | |
var result = m % f // this returns the remainder and it is 1 | |
// comparison operators are: < , > , <= , >= , == , != | |
// they help to compare lefthand side operand to the righthand side | |
c > d // is c greater than d if yes then true | |
c >= e // is c greater than or equal to if yes then true | |
// you can negate a boolean with ! and it changes it to false if it is true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment