The return statement on Swift
On one of my test code, I call some test methods, and I want to skip the following tests, so I add a return statement after the method I…

On one of my test code, I call some test methods, and I want to skip the following tests, so I add a return
statement after the method I want to finish the test, but I find that the method after return
was also be executed, the code is like below:func test1() {
print("Test 1")
}func test2() {
print("Test 2")
}func test3() {
print("Test 3")
}func test4() {
print("Test 4")
}func test() {
test1()
test2()
return
test3()
test4()
}
The output will like below:Test 1
Test 2
Test 3
In order to return the execution on the return statement, we should add a ;
after the return, like below:return;
Actually, Xcode will show the warning like below:

The method test3()
is using as the argument to return, so the test3() was executed.
After add ;
on the return, only one warning message left.
