Browse Source

Merge pull request #65 from arawkins/wipdocs

Edits to error-handling.md and misc.md
abakobo 8 years ago
parent
commit
183a004896

+ 9 - 9
modules/monkey/docs/language/error-handling.md

@@ -12,9 +12,9 @@ You can declare multiple exception classes to handle different types of exceptio
 
 After an exception is caught and handled, program flow exits the Try/Catch block and continues.
 
-When a try block has multiple catch blocks and an exception is thrown, the first catch block capable of handling the exception is executed. If no suitable catch block can be found, the exception is passed to the next most recently executed try block, and so on.
+When a Try block has multiple Catch blocks and an exception is thrown, the first Catch block capable of handling the exception is executed. If no suitable Catch block can be found, the exception is passed to the next most recently executed Try block, and so on.
 
-If no catch block can be found to catch an exception, a runtime error occurs and the application is terminated.
+If no Catch block can be found to catch an exception, a runtime error occurs and the application is terminated.
 
 The Try/Catch method of error-handling allows code to be written without the need to manually check for errors at each step, provided an exception has been set up to handle any errors that are likely to be encountered.
 
@@ -36,19 +36,19 @@ Example code:
 #Import "<std>"
 Using std..
 
-Class custoEx Extends Throwable
+Class CustomException Extends Throwable
 	Field msg:String
 
-  Method New (mesag:String)
-   Self.msg = mesag
-  End
+  	Method New (message:String)
+   		Self.msg = message
+  	End
 End
 
-Function Main()
+Function Main:Void()
 	Local somethingWrong:=True
 	Try
-		If somethingWrong=True Then Throw New custoEx ("Custom Exception detected")
-	Catch err:custoEx
+		If somethingWrong=True Then Throw New CustomException ("Custom Exception detected")
+	Catch err:CustomException
 		Print err.msg
 	End
 End

+ 12 - 1
modules/monkey/docs/language/misc.md

@@ -1,9 +1,20 @@
 ### Miscellaneous
 
-#### Code lines splitting
+#### Line breaks in code
 
 Lines can currently only be split after ‘[‘, ‘(‘ or ‘,’ tokens.
 
+```
+Local myArray:Int[] = New Int[](
+    0,
+    1,
+    2)
+
+Local myarray2:String[,] = New String[
+    10,
+    10]
+```    
+
 #### $ Hexadecimal
 
 Hexadecimal numbers can be entered using the $ symbol