วิตามินมอบพลังอันยิ่งใหญ่ที่คุณต้องการและไม่เข้ามาขวางทางเมื่อคุณไม่ทำ
หมายเหตุ: ปัจจุบันภาษาเป็นงานที่กำลังดำเนินการอยู่ดังนั้นคาดว่าสิ่งส่วนใหญ่จะไม่ทำงาน!
ทำความรู้จักกับวิตามินด้วยโปรแกรมตัวอย่าง
สำหรับคำอธิบายที่สมบูรณ์โปรดดูคู่มืออ้างอิงภาษา
เอกสารและตัวอย่างเพิ่มเติมยังสะท้อนอยู่ในเว็บไซต์ภาษาวิตามิน ข้อความที่ตัดตอนมาจากรหัสบนเว็บไซต์นั้นง่ายต่อการอ่านเพราะมีไวยากรณ์สูง!
Buzz Fizz Simple
fizzbuzz(i: Int) =
case
of i mod 15 == 0 'FizzBuzz'
of i mod 3 == 0 'Fizz'
of i mod 5 == 0 'Buzz'
of _ Str(i)
for i in range(100)
print(fizzbuzz(i))
เวกเตอร์ขนาดปลอดภัย
# Vectors of length `n` and element type `a` are pointers to mutable values of type `a`
unique Vector(n: Size, a: Type) = Record(items: &mut a)
# Parameters `n`, `m` and `a` will be computed and passed implicitly
concat(x: Vector($n, $a), y: Vector($m, a)) =
items = new(mut, a, count=n + m)
copy(from=x.items, to=items, count=n)
copy(from=y.items, to=offset(items, n), count=m)
(items=items) as Vector(n + m, a)
# Assume these vectors are defined somewhere else
a : Vector(3, Int)
b : Vector(2, Int)
assert type-of(concat(a, b)) == Vector(5, Int)
ต้องใช้ NIM 1.4.2 และว่องไว
chmod +x build
# install dependencies
./build setup
# run tests (optional)
./build test
# compile for the current architecture
./build Vitamin Binary vita จะปรากฏในไดเรกทอรี bin
สิ่งที่ต้องทำ
โดยค่าเริ่มต้นวิตามินคาดว่าเนื้อหาของ res/lib จะมีอยู่ใน ~/.local/lib/vita หรือ /usr/lib/vita นอกจากนี้คุณยังสามารถเพิ่มเส้นทางห้องสมุดอื่น ๆ ไปยังตัวแปรสภาพแวดล้อม VITAPATH (เส้นทางคั่นด้วยลำไส้ใหญ่ :
# assuming `vita` is in PATH
# run a program
vita script.v
# run an interactive session
vitaVIM: รองรับไวยากรณ์พื้นฐาน
res/vitamin.vim ไปยังไดเร็กทอรี VIM/NeoVim syntax.vimrc : au BufRead,BufNewFile *.{v,vita} set filetype=vitaminVisual Studio Code: รองรับไวยากรณ์พื้นฐาน
Vitamin ( ext install maxadamski.vitamin ) อย่าลังเลที่จะเปิดปัญหาเพื่อถามคำถามหรือให้คำแนะนำ
ยินดีต้อนรับการมีส่วนร่วมอย่างมาก