mirror of
https://github.com/Nexoniarz/Finch.git
synced 2026-11-03 16:54:25 +00:00
const, if as a value, """ text over several lines, min/max/abs/clamp, import a/b and import x as y, the fs module
- const NAME = value (numbers, text, other constants; typed: const f32 G = 9.8), also module.NAME
- x := if c { a } else { b }
- """ ... """: the closing quotes' indentation goes from every line
- min, max, abs, clamp for any numbers, unless your own function has the name
- import ui/button (a module in a folder), import path as p
- fs: read_bytes, write_bytes, exists, is_dir, mkdir (with parents), list, remove_dir, data_dir(app)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016GzNP6r8dg6WDxUVZy8wjL
This commit is contained in:
parent
d0666cf788
commit
f2d6480749
21 changed files with 688 additions and 17 deletions
33
tests/new/lang_additions.fch
Normal file
33
tests/new/lang_additions.fch
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
// const, if as a value, min/max/abs/clamp, import a/b and import x as y, """ text
|
||||
import ui/button
|
||||
import path as p
|
||||
import ui/button as b2
|
||||
|
||||
const W = 640
|
||||
const H = W / 2
|
||||
const f32 G = 9.8
|
||||
const TITLE = "Game " + "One"
|
||||
const NEG = -W
|
||||
|
||||
fn main() {
|
||||
print(W, H, G, TITLE, NEG, button.SIZE)
|
||||
bt := button.make("ok")
|
||||
button.Button other
|
||||
print(bt.label, bt.w, other.w, b2.make("x").w)
|
||||
print(p.base("/a/b.txt"))
|
||||
x := 7
|
||||
v := if x > 5 { "big" } else if x > 2 { "mid" } else { "small" }
|
||||
f32 s = if x > 5 { 1.5 } else { 0.5 }
|
||||
print(v, s, if x == 7 { x * 2 } else { 0 })
|
||||
print(min(3, 9), max(2.5, 1), abs(-4), abs(-2.5), clamp(15, 0, 10), clamp(-3, 0, 10), min(5, 2, 8))
|
||||
f32 sp = 2.0
|
||||
print(clamp(sp * 3.0, 0.0, 5.0), max(u8(3), u8(200)))
|
||||
shader := """
|
||||
#version 330
|
||||
void main() {
|
||||
gl_Position = vec4(0.0);
|
||||
}
|
||||
"""
|
||||
print(shader)
|
||||
print("""one "quoted" line""")
|
||||
}
|
||||
Loading…
Reference in a new issue