I ran across this piece of code and was wondering what the ? means in this case? It is part of an if statement condition
if user_input.include? "s"
what does the "?" mean?
sorry, i'm new to ruby
I ran across this piece of code and was wondering what the ? means in this case? It is part of an if statement condition
if user_input.include? "s"
what does the "?" mean?
sorry, i'm new to ruby
The ?
is part of the method name.
In Ruby, method names are allowed to end in a ?
or an !
. Typically, ?
indicates a predicate (a method that returns a Boolean), and !
indicates a destructive operation (something that modifies the receiver object).