Skip to content

Instantly share code, notes, and snippets.

@LokieVikky
Created January 28, 2023 12:37
Show Gist options
  • Save LokieVikky/7b6dc158bc07309a54e8bef45311f50e to your computer and use it in GitHub Desktop.
Save LokieVikky/7b6dc158bc07309a54e8bef45311f50e to your computer and use it in GitHub Desktop.
void main() {
// Imutability - final and const
// const variables should be initialized while declaring in complie time.
// final variables can be initialized during runtime.
// Both final and const variables can only be set once, (i.e cannot be reassigned)
// Operators
// Arithmetic - + , - , * , / , %, ++, --
// Logical - && || !
// comparison - < , >, ==, !=, <=, >=
// equality - =
// int a = 1 + 1;
// int b = a + 2;
// int c = a + b;
// bool test = 5 < 10;
// Logical - && (AND) ||(OR) !(NOT)
int a = 10, b = 10, c = 30, d = 40;
// print(d < a || c < a);
// && - return true if both sides are true
// || - return true if any of the side is true
// print(a < b);
// print(a > b);
// print(a == b);
// print(a != b);
// print(!(a<=b));
// Task Notes for ++num and num++
// Notes for operator precedence
int num = 0, num1 = 0;
int test = num++;
int test2 = ++num1;
// print(test);
// print(test2);
test = test + 2;
// test%=2;
// overriding operator precedence using brackets
double value = ((10 + 5) / 20) * (3 % 5);
print(value);
print(5 / 20);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment