1から100までの数あてゲーム 誤差がプラス5の場合は少し大きいと表示する 誤差がマイナス5の場合は少し小さいと表示する
fun guess(x: Int): String = if (x in (1..100)) { when { (x - 5) == y -> "少し小さい" (x + 5) == y -> "少し大きい" else -> "正解" } } else { "範囲外" }
1から100までの数あてゲーム 誤差がプラス5の場合は少し大きいと表示する 誤差がマイナス5の場合は少し小さいと表示する
fun guess(x: Int): String = if (x in (1..100)) { when { (x - 5) == y -> "少し小さい" (x + 5) == y -> "少し大きい" else -> "正解" } } else { "範囲外" }
Generate
More than just a code generator. A tool that helps you with a wide range of tasks. All in one place.
Function from Description
Text Description to SQL Command
Translate Languages
Generate HTML from Description
Code to Explanation
Fix invalid Code
Get Test for Code
Class from Description
Regex from Description
Regex to Explanation
Git Command from Description
Linux Command
Function from Docstring
Add typing to code
Get Language from Code
Time complexity
CSS from Description
Meta Tags from Description