There are several ways to get Bash to read the whole thing before executing.
My preferred method is to write a main() function, and call main "$@" at the very end of the script.
Another trick, useful for shorter scripts, is to just wrap the body of the script in {}, which causes the script to be a giant compound command that is parsed before any of it is executed; instead of a list of commands that is executed as read.