Jump to content

While loop

From Squishu Wiki
Revision as of 19:13, 5 July 2025 by Princesssquishuskush (talk | contribs) (Created page with "== General == == Syntax == <pre> while condition do statements done </pre> == Examples == <pre> echo "Enter password" read trythis while [ "$trythis" != "secret" ]; do echo "Sorry, try again" read trythis done </pre>")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

General

Syntax

while condition do
  statements
done

Examples

echo "Enter password"
read trythis

while [ "$trythis" != "secret" ]; do
  echo "Sorry, try again"
  read trythis
done