KU Language Documentation 4 Examples
Interactive code examples with syntax checking, compilation, and execution
📚 Table of Contents
1. Basic Example
Simple variable and arithmetic operations
📄 basic_example.hudhud
// Kurdi - Basic Example with NATIVE keywords
guherbar yek = 10;
guherbar du = 20;
guherbar kom = yek + du;
çap_bike(kom);
2. Functions
Function declarations and calls
📄 functions.hudhud
// Kurdi - Fonksiyonan
// Minaken penasekirina u bikaranina fonksiyonan
// Fonksiyona hesan
fonksiyon silav_bide() {
çap_bike("Silav Cihan!");
}
// Fonksiyon bi parametreyan
fonksiyon le_zede_bike(a, b) {
vegerine a + b;
}
// Fonksiyon bi jekirine
fonksiyon je_bike(a, b) {
vegerine a - b;
}
// Fonksiyonen matematiki
fonksiyon çargoşe(x) {
vegerine x * x;
}
fonksiyon kup(x) {
vegerine x * x * x;
}
// Bikaranina fonksiyonan
silav_bide();
bila encam1 = le_zede_bike(5, 3);
çap_bike(encam1);
bila encam2 = je_bike(10, 5);
çap_bike(encam2);
bila encam_çargoşe = çargoşe(4);
çap_bike(encam_çargoşe);
bila encam_kup = kup(3);
çap_bike(encam_kup);
// Hevgirtina fonksiyonan
bila tevahi = le_zede_bike(çargoşe(3), kup(2));
çap_bike(tevahi);
3. Loops
While and for loops
📄 loops.hudhud
// Kurdi - Lup
// Minaken lupe bi peyven esli
// Lupa sade - berhevok ji 1 heta 5
bila berhevok = 0;
bila jimarvan = 1;
dema (jimarvan <= 5) {
berhevok = berhevok + jimarvan;
jimarvan = jimarvan + 1;
}
berhevok;
4. Arrays
Array operations
📄 arrays.hudhud
// Kurdi - Arrays
// Arrays with native keywords
// Create arrays
guherbar jimarekan = [1, 2, 3, 4, 5];
guherbar navan = ["Ehmed", "Fatma", "Hesen"];
// Access elements
guherbar yekem = jimarekan[0];
guherbar duyem = jimarekan[1];
// Result
yekem;