IfMath2.ksh

#!/bin/ksh

# IfMath2.ksh

# This program introduces multiple tests
# ( AND => "&&" and OR => "||" )
# inside of an "if" statement.

# - Jim

# prompt the user to enter a number.
print -n "Enter your age: "
read Age

print

print -n "Enter the number of children you have: "
read NumberOfChildren

if ( (( Age < 30 )) && (( NumberOfChildren == 0 )) ); then

  # Note the use of == and not =
  print "Single and loving it!"

fi

if ( (( Age >= 30 )) || (( NumberOfChildren > 0 )) ); then

  print "Bummer!"
  print "Things could be worse.  You could be a Cubs fan."

fi