-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
enum IOType:
case StdIO
case DummyIO(var input: String, var output: String)IOType 정의가 이렇게 되어있는데
given Reader[IOType] with
extension (r: IOType)
// Hint: Use scala.Console.in.read().toChar
def readChar(): Option[Char] = r match {
case StdIO => Some(scala.Console.in.read().toChar)
case DummyIO(input, output) => {
val char = input.headOption
input = input.drop(1)
char
}
case _ => None
}reader에서 DummyIO input에 접근하여 input을 수정하려 하니 val으로 선언되어 있어 안된다고 합니다.
IOType 정의상에는 var로 되어있는데 제가 잘못 짚고 있는것일까요?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels