What is the proper “monkey2” way of implementing returns? I’ve noticed that I get the Missing Return Statement error on any method that has conditional returns
The example below will give the error because of the conditional return:
Monkey
1
2
3
4
5
6
7
8
9
Method Init:Bool()
IfNotsteps Return0
If(steps.First.init=True)
ReturnFalse
Else
steps.First.init=True
ReturnTrue
Endif
EndMethod
Of course, I can make the build process happy if I change it to:
Monkey
1
2
3
4
5
6
7
8
9
10
Method Init:Bool()
IfNotsteps Return0
If(steps.First.init=True)
ReturnFalse
Else
steps.First.init=True
ReturnTrue
Endif
Returntrue' This seems silly to me!
EndMethod
Is there a better way to to do conditional returns?