Hello, I’ve got a problem with comparison numbers(values). It’s really confusing me.
ONE_TRY(){
echo "tries=$TRIES, random_number is $1 guess_number is $2"
if [[ $1r < $2 ]];
then
echo "It's lower than that, guess again:"
((TRIES++))
echo "Lower" $TRIES
read GUESS_NUMBER
elif [[ $1 > $2 ]];
then
echo "It's higher than that, guess again:"
((TRIES++))
echo "higher" $TRIES
read GUESS_NUMBER
else
echo "You guessed it in $TRIES tries. The secret number was $RANDOM_NUMBER. Nice job!"
break
fi
}
GUESSING_GAME() {
TRIES=0
RANDOM_NUMBER=$($PSQL "SELECT floor(random() * 1000 + 1)::int;")
echo "Enter your username"
read USER_NAME
echo "Welcome, $USER_NAME! It looks like this is your first time here."
echo "Guess the secret number between 1 and 1000:"
read GUESS_NUMBER
while [[ true ]]
do
ONE_TRY $RANDOM_NUMBER, $GUESS_NUMBER
done
}
GUESSING_GAME`Preformatted text`
But the outcome which I got surprised me. It is supposed to be equal