Skip to content

Commit

Permalink
Merge pull request #15 from rosera/tastethedream-patch-13
Browse files Browse the repository at this point in the history
Update ex4-4.md
  • Loading branch information
rosera authored Dec 15, 2022
2 parents 1e51267 + b156984 commit ef5527c
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions ch04/ex4-4.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,19 @@

```dart
void main() {
int value = 5;
int intSquared(value) => value * value;
int intCubed(value) => value * value * value;
int value = 5;
print('$value squared is ${intSquared(value)}');
print('$value cubed is ${intCubed(value)}');
// Anonymous Function - Style 1
int ex1Squared(num1) => num1 * num1;
int ex1Cubed(num1) => num1 * num1 * num1;
// Anonymous Function - Style 2
int ex2Squared(num1){ return num1 * num1; }
int ex2Cubed(num1){ return num1 * num1 * num1; }
print('EX1: $value squared is ${ex1Squared(value)}');
print('EX1: $value cubed is ${ex1Cubed(value)}');
print('EX2: $value squared is ${ex2Squared(value)}');
print('EX2: $value cubed is ${ex2Cubed(value)}');
}
```

0 comments on commit ef5527c

Please sign in to comment.