BEGIN END questions

Why would you need to use this in a script?
Why can't you just use print to print out what you want printed in the begining and print for what you want at the end.

So this:

nawk 'BEGIN {print "this is the first line"}
{print $1 $2 $3}
{print $5 $6}
END {print "this is the last line"}'

why can't i just or why would I not use:

print "this is the first line"
nawk 
'{print $1 $2 $3}
{print $5 $6}'
print "this is the last line"

Just the rules of the game!

Regards

Because you may need something like this or much more:

awk 'BEGIN {
  printf "Number of arguments: %d\n",
    ARGC
    }
END {
  printf "Number of records read: %d\n",
    NR
}' input