Ruby - Control Flow
Find the mistake in this Ruby method using a guard clause:
def validate(input) return "Empty input" if input = "" "Input is valid" end
def validate(input) return "Empty input" if input = "" "Input is valid" end
= which is assignment, not comparison. It should be == to compare input with an empty string.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions