URL: http://atnd.org/events/34622
Booの公式はこちらです
http://boo.codehaus.org/Part+14+-+Exceptions
http://boo.codehaus.org/Exception+Handling
・ExceptionTest.boo
import System class ExceptionTest (MonoBehaviour): def Start (): try: Debug.Log(1 / 0) except e as DivideByZeroException: print "Whoops" print "Doing more..."
とUnityらしく書きました。
Assets/Scripts/ExceptionTest.boo(7,25): BCE0055: Internal compiler error: Division by zero.
実行時すると実行する前にこのエラーで怒られました。
さらにこれも
import System public class MyClass: def SomethingBad(): Debug.Log(1 / 0) class ExceptionTest (MonoBehaviour): def Start (): try: s = MyClass() s.SomethingBad() ensure: print "This code will be executed, whether there is an error or not."
実行する前にすでに怒られます・・。
これだと書けないね。
では次へ