Compiler in Rust (lexer, parser, checker, C codegen), maps, chars, dino fmt, dino lsp (diagnostics, formatting, outline, definition, hover, completion, signature help), docs, examples, VS Code/Vim files. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
24 lines
446 B
Plaintext
24 lines
446 B
Plaintext
const PI = 3.14159
|
|
|
|
func area(r: float): float {
|
|
return PI * r * r
|
|
}
|
|
|
|
func average(a, b: int): float {
|
|
return float(a + b) / 2
|
|
}
|
|
|
|
func main() {
|
|
print("area:", area(2))
|
|
print("avg:", average(3, 4))
|
|
print(10 / 3, 10 % 3, 10.0 / 4)
|
|
print(int(7.9), float(3))
|
|
var x: float = 1
|
|
x *= 2.5
|
|
print(x, x > 2, -x)
|
|
print("whole float:", 2.0 * 3)
|
|
var big = 9223372036854775807
|
|
big += 1
|
|
print("wraps:", big)
|
|
}
|