Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e25e236

Browse files
authoredDec 7, 2018
Merge pull request #1664 from icattlecoder/develop
improve if else statements in example
2 parents ba53858 + 4f72b2e commit e25e236

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed
 

‎src/ch15-05-interior-mutability.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,12 @@ impl<'a, T> LimitTracker<'a, T>
161161

162162
let percentage_of_max = self.value as f64 / self.max as f64;
163163

164-
if percentage_of_max >= 0.75 && percentage_of_max < 0.9 {
165-
self.messenger.send("Warning: You've used up over 75% of your quota!");
166-
} else if percentage_of_max >= 0.9 && percentage_of_max < 1.0 {
167-
self.messenger.send("Urgent warning: You've used up over 90% of your quota!");
168-
} else if percentage_of_max >= 1.0 {
164+
if percentage_of_max >= 1.0 {
169165
self.messenger.send("Error: You are over your quota!");
166+
} else if percentage_of_max >= 0.9 {
167+
self.messenger.send("Urgent warning: You've used up over 90% of your quota!");
168+
} else if percentage_of_max >= 0.75 {
169+
self.messenger.send("Warning: You've used up over 75% of your quota!");
170170
}
171171
}
172172
}

0 commit comments

Comments
 (0)
Please sign in to comment.