Improved type system

This commit is contained in:
2025-02-17 14:31:47 +01:00
parent 3550f9e24e
commit b8e37fafae
62 changed files with 189 additions and 172 deletions

View File

@ -5,7 +5,7 @@ main() {
collatz(12)
}
collatz(x Int) {
collatz(x int) {
loop {
if x & 1 == 0 {
x /= 2

View File

@ -4,7 +4,7 @@ main() {
log.number(factorial(5))
}
factorial(x Int) -> Int {
factorial(x int) -> int {
if x <= 1 {
return 1
}

View File

@ -4,7 +4,7 @@ main() {
log.number(fibonacci(10))
}
fibonacci(x Int) -> Int {
fibonacci(x int) -> int {
if x <= 1 {
return x
}

View File

@ -5,7 +5,7 @@ main() {
fizzbuzz(15)
}
fizzbuzz(n Int) {
fizzbuzz(n int) {
x := 1
loop {

View File

@ -4,7 +4,7 @@ main() {
log.number(gcd(1071, 462))
}
gcd(a Int, b Int) -> Int {
gcd(a int, b int) -> int {
loop {
switch {
a == b { return a }

View File

@ -2,8 +2,8 @@ import mem
import sys
struct Point {
x Int
y Int
x int
y int
}
main() {
@ -12,7 +12,7 @@ main() {
delete(p)
}
construct(x Int, y Int) -> *Point {
construct(x int, y int) -> *Point {
p := new(Point)
p.x = x
p.y = y

View File

@ -22,7 +22,7 @@ main() {
}
}
isPrime(x Int) -> Int {
isPrime(x int) -> int {
if x == 2 {
return 1
}

View File

@ -1,5 +1,5 @@
extern user32 {
MessageBoxA(window *Any, text *Int8, title *Int8, type UInt)
MessageBoxA(window *any, text *int8, title *int8, flags uint)
}
main() {