Hello coders, In this post, you will learn how to solve the Getting started with conditionals HackerRank Solution. This problem is a part of the Linux Shell series.

Problem
Read in one character from STDIN.
If the character is ‘Y’ or ‘y’ display “YES”.
If the character is ‘N’ or ‘n’ display “NO”.
No other character will be provided as input.
Input Format
One character
Constraints
The character will be from the set {yYnN}.
Output Format
echo YES
or NO
to STDOUT.
Sample Input
y
Sample Output
YES
Getting started with conditionals HackerRank Solution
#!/bin/bash read word if [[($word == 'y') || ($word == 'Y')]] then echo "YES" elif [[($word == 'n') || ($word == 'N')]] then echo "NO" fi
Note: This problem (Getting started with conditionals) is generated by HackerRank but the solution is provided by chase2learn. This tutorial is only for Learning and Educational purpose.