The special sauce in the script is a form of conditional expression.
VAR1=${VAR1:-~/examples/hello-world}
means that VAR1 will be set to ~/examples/hello-world if it's not already set.
Can also be done with if...then like this:
if [[ -z ${VAR1} ]]; then VAR1=~/examples/hello-world; fi
This is the conditional expression:
${VAR1:-SOMETHING}
It means if VAR1 is null the return SOMETHING else return VAR1
PS. Your title is a little misleading. The only thing that happens is if you set the variable VAR1 before executing the script, it will use that value instead of the default inside the script.