Complete the method that takes a boolean value and return a "Yes" string for true, or a "No" string for false.
Solution:
String bool_to_word(bool boolean) {
String result = "No";
if (boolean == true) {
result = "Yes";
}
return result;
}
// or
String bool_to_word(bool boolean) => boolean ? "Yes" : "No";
'나는 이렇게 학습한다 > Algorithm & SQL' 카테고리의 다른 글
| 1118. Function 1 - hello world (0) | 2022.11.18 |
|---|---|
| 1117. Reverse List Order (0) | 2022.11.17 |
| 1115. Reversed Strings (0) | 2022.11.15 |
| 1114. Exclamation marks series #6: Remove n exclamation marks in the sentence from left to right (0) | 2022.11.14 |
| 1113. Parse nice int from char problem (0) | 2022.11.13 |