dart keywords code example
Example 1: dart function
when you want to make a function that
doesn't use the format return or a function that doesn't return a value
the function base will look like this:
void functionName() {
}
if its returning some thing it will look like this:
functionName() {
}
Example 2: dart ?? operator
int val1;
final int val2 = 20;
console.log(val1 ?? val2); //result => 20 because val1 is null
----------------------------------
final int val1 = 30;
final int val2 = 20;
console.log(val1 ?? val2); //result => 30 because val1 is not null
Example 3: dart function syntax
sum(x, y) {
return x + y;
}
// This is where the app starts executing.
void main() {
print(sum(3,5)); // => 8
}