Improved type system
This commit is contained in:
@ -5,7 +5,7 @@ main() {
|
||||
collatz(12)
|
||||
}
|
||||
|
||||
collatz(x Int) {
|
||||
collatz(x int) {
|
||||
loop {
|
||||
if x & 1 == 0 {
|
||||
x /= 2
|
||||
|
@ -4,7 +4,7 @@ main() {
|
||||
log.number(factorial(5))
|
||||
}
|
||||
|
||||
factorial(x Int) -> Int {
|
||||
factorial(x int) -> int {
|
||||
if x <= 1 {
|
||||
return 1
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ main() {
|
||||
log.number(fibonacci(10))
|
||||
}
|
||||
|
||||
fibonacci(x Int) -> Int {
|
||||
fibonacci(x int) -> int {
|
||||
if x <= 1 {
|
||||
return x
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ main() {
|
||||
fizzbuzz(15)
|
||||
}
|
||||
|
||||
fizzbuzz(n Int) {
|
||||
fizzbuzz(n int) {
|
||||
x := 1
|
||||
|
||||
loop {
|
||||
|
@ -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 }
|
||||
|
@ -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
|
||||
|
@ -22,7 +22,7 @@ main() {
|
||||
}
|
||||
}
|
||||
|
||||
isPrime(x Int) -> Int {
|
||||
isPrime(x int) -> int {
|
||||
if x == 2 {
|
||||
return 1
|
||||
}
|
||||
|
@ -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() {
|
||||
|
Reference in New Issue
Block a user