Branching in AppleScript

need a way to do a branch that can be directed to go to a specific line of code, ie, use it in an IF statement to jump over the following line of code or go to other lines of code, or in a program that runs many times and want to start it the second and following times at a code line that is after the initionalization of variables at the top of the program.

There is not “go to” in AppleScript, but there are certain capabilities of processing control, such as if-else-end if and handlers with parameters. Eg:

if var is "John" then
	display dialog "John"
else
	display dialog "Kalvin"
end if

doSomething(5) --> 3125.0

doSomething(4) --> 256.0

to doSomething(x) --> this is a handler with 1 positional parameter
	return x ^ x
end doSomething