Prime Checker - Vala Typing CST Test
Loading…
Prime Checker — Vala Code
Checks if numbers are prime.
bool isPrime(int n) {
if (n < 2) return false;
for (int i = 2; i*i <= n; i++) {
if (n % i == 0) return false;
}
return true;
}
int[] nums = {7, 10, 13};
foreach (int n in nums) {
stdout.printf("%d is %s\n", n, isPrime(n) ? "Prime" : "Not Prime");
}Vala Language Guide
Vala is a high-level, object-oriented programming language that provides modern language features while targeting the GObject type system of the GNOME platform. It compiles to C, enabling native performance and seamless integration with existing C libraries and GNOME APIs.
Primary Use Cases
- ▸Desktop application development for GNOME
- ▸Library development with GObject integration
- ▸System utilities and tools
- ▸Cross-platform C code generation
- ▸Rapid prototyping with native performance
Notable Features
- ▸High-level object-oriented syntax
- ▸Automatic memory management via reference counting
- ▸Signals and properties for GObject integration
- ▸Generics and interfaces support
- ▸Seamless compilation to C
Origin & Creator
Developed by Jürg Billeter and Raffaele Sandrini in 2006 to simplify GNOME application development while providing modern programming constructs.
Industrial Note
Vala is mainly used in GNOME desktop applications, system utilities, and open-source software that requires native performance with high-level language features.