Tweaked tabs-vs-spaces

This commit is contained in:
2025-01-12 11:16:46 +11:00
parent 101833934b
commit 4282268f3d
10 changed files with 82 additions and 77 deletions

View File

@@ -46,19 +46,19 @@ You can control the program flow with either `if`, `while` or `for`. The only fa
```
if (check()) {
//do this
//do this
}
else {
//otherwise do this
//otherwise do this
}
var i = 0;
while (i < 10) {
print i++;
print i++;
}
for (var i = 0; i < 10; i++) {
print i;
print i;
}
```
@@ -70,7 +70,7 @@ Functions are defined with the `fn` keyword, and can take any number of argument
```
fn combine(a, b, c) {
return [a, b, c];
return [a, b, c];
}
print combine(1, 2, 3);
@@ -80,7 +80,7 @@ Variable number of parameters, called rest parameters, can be passed in as an ar
```
fn combine(...rest) {
return rest;
return rest;
}
print combine(1, 2, 3);
@@ -92,7 +92,7 @@ Functions can be called using the universal function call syntax, which is just
```
fn printMe(self) {
print self;
print self;
}
array.printMe();

View File

@@ -104,7 +104,7 @@ This function takes either an array or a dictionary as the `self` argument and a
import standard;
fn p(i, x) {
print x;
print x;
}
var a = [1, 3, 5];
@@ -136,7 +136,7 @@ This function takes either an array or a dictionary as the `self` argument, and
import standard;
fn increment(k, v) {
return v + 1;
return v + 1;
}
var a = [1, 2, 3];
@@ -152,7 +152,7 @@ This function takes either an array or a dictionary as the `self` argument, a de
import standard;
fn f(acc, k, v) {
return acc + v;
return acc + v;
}
var a = [1, 2, 3, 4];
@@ -172,7 +172,7 @@ This function takes an array as the `self` argument, and a comparison function a
import standard;
fn less(a, b) {
return a < b;
return a < b;
}
var a = [4, 1, 3, 2];

View File

@@ -46,8 +46,8 @@ var entry: type = astype [string: [string]];
//define a phonebook which follows the above signature
var phonebook: entry = [
"Lucy": ["1234", "Cabbage Ln"],
"Bob": ["5678", "Candy Rd"]
"Lucy": ["1234", "Cabbage Ln"],
"Bob": ["5678", "Candy Rd"]
];
```
@@ -82,12 +82,12 @@ Types are first-class citizens. What this means is that they can be used just li
```
fn decide(question) {
if (question) {
return int;
}
else {
return float;
}
if (question) {
return int;
}
else {
return float;
}
}
var t = decide(true);