Magic 8-ball: Difference between revisions

(Added Easylang)
Line 2,769:
<syntaxhighlight lang="bash">#!/bin/bash
declare -ra RESPONSES=("It is certain" "It is decidedly so" "Without a doubt"
"Yes definitely" "You may rely on it" "As I see it yes"
"Most likely" "Outlook good" "Signs point to yes" "Yes"
Line 2,781:
find the answers you seek. Type 'quit' to exit.\n\n"
 
until
while true; do
read -p 'Enter Question: ' question
if [[ "$questionREPLY" == "quit" ]; then]
do printf "Response: %s\n\n" "${RESPONSES[response_indexRANDOM % 20]}\n\n"
exit 0
done
fi
done</syntaxhighlight>
 
{{out}}
response_index=$(($RANDOM % 20))
 
printf "Response: ${RESPONSES[response_index]}\n\n"
done</syntaxhighlight>
Output:
<pre>Welcome to 8 ball! Enter your questions using the prompt below to
find the answers you seek. Type 'quit' to exit.
1,934

edits