mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 23:04:08 +10:00
Removed export keyword from README.md
This commit is contained in:
@@ -60,8 +60,6 @@ var tally = makeCounter();
|
|||||||
print tally(); //1
|
print tally(); //1
|
||||||
print tally(); //2
|
print tally(); //2
|
||||||
print tally(); //3
|
print tally(); //3
|
||||||
|
|
||||||
export tally; //export this variable to the host program
|
|
||||||
```
|
```
|
||||||
|
|
||||||
# License
|
# License
|
||||||
|
|||||||
@@ -1,6 +1,26 @@
|
|||||||
import compound;
|
import standard; //for a bunch of utility functions
|
||||||
var arr: [int] = [1, 2, 3];
|
|
||||||
fn f(_, v: int): int { return v + 1; }
|
|
||||||
print arr.map(f);
|
|
||||||
|
|
||||||
|
|
||||||
|
print "Hello world"; //"print" is a keyword
|
||||||
|
|
||||||
|
var msg = "foobar"; //declare a variable like this
|
||||||
|
|
||||||
|
assert true, "This message won't be seen"; //assert is another keyword
|
||||||
|
|
||||||
|
//-------------------------
|
||||||
|
|
||||||
|
fn makeCounter() { //declare a function like this
|
||||||
|
var total: int = 0; //declare a variable with a type like this
|
||||||
|
|
||||||
|
fn counter(): int { //declare a return type like this
|
||||||
|
return ++total;
|
||||||
|
}
|
||||||
|
|
||||||
|
return counter; //closures are explicitly supported
|
||||||
|
}
|
||||||
|
|
||||||
|
var tally = makeCounter();
|
||||||
|
|
||||||
|
print tally(); //1
|
||||||
|
print tally(); //2
|
||||||
|
print tally(); //3
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
#define TOY_VERSION_MAJOR 0
|
#define TOY_VERSION_MAJOR 0
|
||||||
#define TOY_VERSION_MINOR 8
|
#define TOY_VERSION_MINOR 8
|
||||||
#define TOY_VERSION_PATCH 1
|
#define TOY_VERSION_PATCH 2
|
||||||
#define TOY_VERSION_BUILD __DATE__ " " __TIME__
|
#define TOY_VERSION_BUILD __DATE__ " " __TIME__
|
||||||
|
|
||||||
//platform-specific specifications
|
//platform-specific specifications
|
||||||
|
|||||||
Reference in New Issue
Block a user