We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I am not an expert, but I think you need to have $a in your round brackets to use the variable. I also changed your round brackets to square brackets because it was a string that the question was comparing. So this worked for me:
read x
if[[$x=="y"||$x=="Y"]]thenecho"YES"elseecho"NO"fi
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Getting started with conditionals
You are viewing a single comment's thread. Return to all comments →
I am not an expert, but I think you need to have $a in your round brackets to use the variable. I also changed your round brackets to square brackets because it was a string that the question was comparing. So this worked for me: