Posts: 133
Threads: 12
Joined: Oct 2013
Reputation:
0
The first will return "Something"
The second will work without returning anything
The last will return alway 1
Posts: 519
Threads: 21
Joined: Nov 2012
Reputation:
0
Basically does the same I guess
Except the middle one?
Posts: 2,528
Threads: 124
Joined: Jul 2009
Reputation:
0
No the same. Let's say "Something" is a function. First snippet requires it to return a value - and that value will be returned by your function. The second one doesn't finish code execution, so when you have code after that "if" it will execute. Won't when using #1 and #3. The third one calls the function (it doesn't have to return any value), and returns constant number 1.
Posts: 71
Threads: 14
Joined: May 2012
Reputation:
0
The function always has to return something, the standard is 1.. you could check it, and if is doesn't work you can return 0..
Posts: 1,079
Threads: 199
Joined: Jun 2013
Reputation:
0
I have to say that, while they are all different, and work differently as well, you can exchange them in various situations, or substitute one for another.
Posts: 591
Threads: 150
Joined: Sep 2013
Reputation:
0
So Number 1 and 3 do the same job.