Skip to content

Commit d22b868

Browse files
authored
Update introduction.md
Since earlier in introduction.md it stated "Perhaps consider making IsQuestion and IsShout values set once instead of functions that are possibly called twice" I feel it's appropriate to actually use that awesome advice. I refactored mine to use said advice.
1 parent 530e244 commit d22b868

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

exercises/practice/bob/.approaches/introduction.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,16 @@ public static string Response(string message)
3333
if (IsSilence(message))
3434
return "Fine. Be that way!";
3535

36-
if (IsYell(message) && IsQuestion(message))
36+
var isYell = IsYell(message);
37+
var isQuestion = IsQuestion(message);
38+
39+
if (isYell && isQuestion)
3740
return "Calm down, I know what I'm doing!";
3841

39-
if (IsYell(message))
42+
if (isYell)
4043
return "Whoa, chill out!";
4144

42-
if (IsQuestion(message))
45+
if (isQuestion)
4346
return "Sure.";
4447

4548
return "Whatever.";

0 commit comments

Comments
 (0)