Skip to content

Commit e6f4850

Browse files
committed
Refactor: Write if statements in one line each
1 parent 9fb0e1d commit e6f4850

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

exercises/tiered_pricing/solutions/xetxeberria-ts/src/tieredPricing.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,10 @@ export function tieredPricing(licenseAmount: number): number {
66

77
function calculateLicensePrice(licenseAmount: number): number {
88
let licensePrice = 299;
9-
if (licenseAmount >= 3) {
10-
licensePrice = 239;
11-
}
12-
if (licenseAmount >= 11) {
13-
licensePrice = 219;
14-
}
15-
if (licenseAmount >= 26) {
16-
licensePrice = 199;
17-
}
9+
10+
if (licenseAmount >= 3) licensePrice = 239;
11+
if (licenseAmount >= 11) licensePrice = 219;
12+
if (licenseAmount >= 26) licensePrice = 199;
1813

1914
return licensePrice;
2015
}

0 commit comments

Comments
 (0)