From: David Kerkeslager Date: Fri, 1 Sep 2017 21:49:00 +0000 (-0400) Subject: Added a future folder to examples X-Git-Url: https://code.kerkeslager.com/?a=commitdiff_plain;h=cfb4e75abc7682119ab133e0d1e5a8cfb4068ee9;p=fur Added a future folder to examples --- diff --git a/examples/future/30_exception.fur b/examples/future/30_exception.fur new file mode 100644 index 0000000..3a55ab3 --- /dev/null +++ b/examples/future/30_exception.fur @@ -0,0 +1,3 @@ +variable = 42 // 0 + +print('This should not print') diff --git a/examples/future/31_stack_trace.fur b/examples/future/31_stack_trace.fur new file mode 100644 index 0000000..21335a8 --- /dev/null +++ b/examples/future/31_stack_trace.fur @@ -0,0 +1,7 @@ +def throws() do + 42 // 0 +end + +variable = throws() + +print('This should not print') diff --git a/examples/future/32_finally.fur b/examples/future/32_finally.fur new file mode 100644 index 0000000..f89d949 --- /dev/null +++ b/examples/future/32_finally.fur @@ -0,0 +1,11 @@ +def throws() do + try + 42 // 0 + finally + print('This should print') + end +end + +variable = throws() + +print('This should not print') diff --git a/examples/future/33_except.fur b/examples/future/33_except.fur new file mode 100644 index 0000000..76e900c --- /dev/null +++ b/examples/future/33_except.fur @@ -0,0 +1,13 @@ +def throws() do + try + 42 // 0 + except(DivisionByZeroError) + print('This should print\n') + 42 + end +end + +variable = throws() + +print('This should also print\n') +print('This should be 42: ', variable, '\n') diff --git a/examples/future/34_except_finally.fur b/examples/future/34_except_finally.fur new file mode 100644 index 0000000..d1aea97 --- /dev/null +++ b/examples/future/34_except_finally.fur @@ -0,0 +1,15 @@ +def throws() do + try + 42 // 0 + except(DivisionByZeroError) + print('This should print first\n') + 42 + finally + print('This should print second\n') + 1 + end +end + +variable = throws() +print('This should print third\n') +print('This shoudld be 42: ', variable, '\n')