瀏覽代碼

Merge pull request #76 from arawkins/wipdocs

Added Alias to user types
abakobo 8 年之前
父節點
當前提交
e543d3e57b
共有 1 個文件被更改,包括 20 次插入0 次删除
  1. 20 0
      modules/monkey/docs/language/user-types.md

+ 20 - 0
modules/monkey/docs/language/user-types.md

@@ -231,3 +231,23 @@ Class Foo
 	Field _somePrivateThing:String
 End
 ```
+
+#### Alias
+
+An `Alias` allows you to create a synonym for a previously declared type.
+
+<div class=syntax>
+`Alias` _Identifier_ `:` _Type_
+</div>
+
+<br>
+You can use your newly declared `Alias` instead of the original type anywhere in your code. For example:
+
+
+```
+Alias FantasticNumber:Int
+Alias FantasticString:String
+
+Local myInt:FantasticNumber = 123
+Local myString:FantasticString = "abc"
+```