I am trying to figure out how I can use a variable outside of the function it was created in without using return. Example:
import UIKit var Finalvar = "test" func test(var1: String) { var Finalvar = var1 } test(var1: "Done") print(Finalvar) as output I get "test" instead of "done", how can I change that?
Finalvar = var1. However, most importantly, read the Swift book as a start, you seem to lack key concepts such as scopes of variables. Also variable and function names should be lower-camelCase (finalvar).