0

I want to return nothing inside a function returning void. How would I do that?

nobody
  • 19,814
  • 17
  • 56
  • 77
Jab
  • 26,853
  • 21
  • 75
  • 114

2 Answers2

4

You can do one of two things:

  1. Structure the flow of the code so that there is no need for a return statement.
  2. Place return; statements where you want the function to return control to the caller.

EDIT: To clarify, return; is a statement that returns control to the caller without yielding a value.

That's basically it.

LBushkin
  • 129,300
  • 32
  • 216
  • 265
0

i think sending a message to nil is a no-op

[nil message]

Sending a message to nil?

Community
  • 1
  • 1
John Boker
  • 82,559
  • 17
  • 97
  • 130