mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 17:41:41 +00:00
Apply some spelling and ordering suggested by @amartincolby
This commit is contained in:
parent
0b5245e2d8
commit
91f1f4f936
@ -8,7 +8,7 @@ contributors:
|
|||||||
Reason is a syntax over OCaml that is easier to get started for programmers who are familiar with C-style syntax like JavaScript. BuckleScript is part of the toolchain which compiles Reason to JavaScript so you can write statically typed code for anywhere that JavaScript runs.
|
Reason is a syntax over OCaml that is easier to get started for programmers who are familiar with C-style syntax like JavaScript. BuckleScript is part of the toolchain which compiles Reason to JavaScript so you can write statically typed code for anywhere that JavaScript runs.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
/* Comments start with slash-star, and end with slash-star */
|
/* Comments start with slash-star, and end with star-slash */
|
||||||
|
|
||||||
/*----------------------------------------------
|
/*----------------------------------------------
|
||||||
* Variable and function declaration
|
* Variable and function declaration
|
||||||
@ -18,7 +18,7 @@ Reason is a syntax over OCaml that is easier to get started for programmers who
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
let x = 5;
|
let x = 5;
|
||||||
/* - Notice we didn't add a type, Reason will infer it's an int */
|
/* - Notice we didn't add a type, Reason will infer x is an int */
|
||||||
|
|
||||||
/* A function like this, take two arguments and add them together */
|
/* A function like this, take two arguments and add them together */
|
||||||
let add = (a, b) => a + b;
|
let add = (a, b) => a + b;
|
||||||
@ -27,7 +27,7 @@ let add = (a, b) => a + b;
|
|||||||
/*----------------------------------------------
|
/*----------------------------------------------
|
||||||
* Type annotation
|
* Type annotation
|
||||||
*----------------------------------------------
|
*----------------------------------------------
|
||||||
* Types don't need tp be explicitly annotated in most cases but when you need
|
* Types don't need to be explicitly annotated in most cases but when you need
|
||||||
* to, you can add the type after the name
|
* to, you can add the type after the name
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ let lastLetter = 'z';
|
|||||||
|
|
||||||
/* > Boolean */
|
/* > Boolean */
|
||||||
|
|
||||||
/* A boolean be either true or false */
|
/* A boolean can be either true or false */
|
||||||
let isLearning = true;
|
let isLearning = true;
|
||||||
|
|
||||||
true && false; /* - : bool = false; Logical and */
|
true && false; /* - : bool = false; Logical and */
|
||||||
@ -445,11 +445,11 @@ switch (driveToTown(evan)) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* Alternatively, a try block can be used */
|
/* Alternatively, a try block can be used */
|
||||||
|
/* - With Reason exceptions can be avoided with optionals and are seldom used */
|
||||||
let messageToEvan =
|
let messageToEvan =
|
||||||
try (driveToTown(evan)) {
|
try (driveToTown(evan)) {
|
||||||
| Under_Age => evan.firstName ++ " is too young to drive!"
|
| Under_Age => evan.firstName ++ " is too young to drive!"
|
||||||
};
|
};
|
||||||
/* - With Reason exceptions can be avoided with optionals and are seldom used */
|
|
||||||
|
|
||||||
/*----------------------------------------------
|
/*----------------------------------------------
|
||||||
* Object
|
* Object
|
||||||
@ -488,7 +488,7 @@ house#temperature; /* - : float = 22. */
|
|||||||
/*----------------------------------------------
|
/*----------------------------------------------
|
||||||
* Module
|
* Module
|
||||||
*----------------------------------------------
|
*----------------------------------------------
|
||||||
* Modules are used to organize your code and provide namespacing,
|
* Modules are used to organize your code and provide namespacing.
|
||||||
* Each file is a module by default
|
* Each file is a module by default
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -537,6 +537,7 @@ module SpecializedStaff = {
|
|||||||
```
|
```
|
||||||
|
|
||||||
## Further Reading
|
## Further Reading
|
||||||
|
|
||||||
- [Official Reason Docs](https://reasonml.github.io/docs/en/what-and-why)
|
- [Official Reason Docs](https://reasonml.github.io/docs/en/what-and-why)
|
||||||
- [Official BuckleScript Docs](https://bucklescript.github.io/docs/en/what-why)
|
- [Official BuckleScript Docs](https://bucklescript.github.io/docs/en/what-why)
|
||||||
- [Try Reason](https://reasonml.github.io/en/try)
|
- [Try Reason](https://reasonml.github.io/en/try)
|
||||||
|
Loading…
Reference in New Issue
Block a user