나는 이렇게 학습한다/Algorithm & SQL
1116. Convert boolean values to strings 'Yes' or 'No'.
daco2020
2022. 11. 17. 01:26
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";