From b156984ad2631645d01157569ca24ca0cd50d6e6 Mon Sep 17 00:00:00 2001 From: Dawn Rose <63545980+tastethedream@users.noreply.github.com> Date: Mon, 5 Dec 2022 17:20:37 +0000 Subject: [PATCH] Update ex4-4.md Code updated to reflect QC2 section 3.5 --- ch04/ex4-4.md | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/ch04/ex4-4.md b/ch04/ex4-4.md index a764c52..c8b5ffc 100644 --- a/ch04/ex4-4.md +++ b/ch04/ex4-4.md @@ -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)}'); } + ```