Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Nesting function

dickthedevdickthedev Posts: 214Registered Users @ @
edited May 5 in iOS SDK Development
Hello, I am learning about nesting function.
the basic syntax is like this:
func outter() -> String {

	func inner() -> String {
	
	return "howdy?"
	}
	
	let b = inner()


return "Hello"
}

let a = outter()

Is this correct? If so, does it mean I can have as many inner functions as I want? perhaps to certain point, the computer can't take it any more?
func level1() ->Int {

	func level2() ->Int {
	
		func level3() ->Int {
		......

		return 3
		}

	return 2
	}

return 1
}


Thanks

Replies

  • dickthedevdickthedev Posts: 214Registered Users @ @
    Hello, I am studying about nesting function.
    the basic syntax is like this:
    func outter() -> String {
    
    
    
    return "Hello"
    }
    
    //invoke
    let a = outter()
    
    
    
    
Sign In or Register to comment.