Jump to content

Control structures

From Squishu Wiki
Revision as of 12:29, 5 July 2025 by Princesssquishuskush (talk | contribs) (Created page with "== General == == Simple if statement == * The general structure of an if statement <pre> if condition then statements else statements fi </pre> <pre> if test -f blah.py then ... fi if [ -f blah.py ] then ... fi You an put then on the same line, but then you have to use a semi if [ -f blah.py ]; then ... fi </pre>")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

General

Simple if statement

  • The general structure of an if statement
if condition
then
  statements
else
  statements
fi
if test -f blah.py
then
...
fi

if [ -f blah.py ]
then
...
fi

You an put then on the same line, but then you have to use a semi

if [ -f blah.py ]; then
...
fi