3 ms·
| int x (>= 0, <=10) | x = parseInt(getKeyboardInput) Will be a compile time error because getKeyBoard input returns integers that are between 0-256(?) not 0-1
by randyrand 13y ago
| int x (>= 0, <=10)
| x = parseInt(getKeyboardInput)
Will be a compile time error because getKeyBoard input returns integers that are between 0-256(?) not 0-10 like 'x' wants.
- jarrett 13y agoExactly. That's why I proposed a Haskell-ish Maybe construct to represent the uncertainty of the input's validity. The code snippet: int x (>= 0, <=10) | x = parseInt(getKeyboardInput) ...was meant as an example of what won't work.