question mark

Scala FAQ: Can you use a question mark to end a method name?

Scala FAQ: Can you use a question mark to end a Scala method name?

Answer: Yes, you can. Just use an underscore character before the question mark. For instance, here’s a method named alive_?:

def alive_? = true

Another possible approach you can use is to use backtick characters around the method name, without using an underscore...

What does '???' (three question marks) mean in Scala?

Scala FAQ: What does the use of three questions marks (???) in Scala mean?

The syntax of using three question marks in Scala lets you write a not-yet implemented method, like this:

def createWorldPeace = ???

The methods you define can also take input parameters and specify a return type, like this: