Your first Ifá-Lang program
Every programming journey starts with a simple program that displays "Hello, World!" on the screen. In
Ifá-Lang, we use the Irosu domain for console output (or Fmt/Log in English).
Here's your first Ifá-Lang program:
// hello.ifa - Your first Ifá program
Irosu.fo("Kaabo, Ifá!");
// hello.ifa - Your first Ifá program
// 'Irosu' can be 'Fmt' or 'Log'
Fmt.println("Hello, Ifá!");
Let's break it down:
// — A comment, ignored by the interpreterIrosu — The Console I/O domain (Odù pattern: 1100). Alias: Fmt or
Log..fo() — The "print line" method (short for "fọ̀rọ̀" = speak). Alias:
println()."Kaabo, Ifá!" — A string to display.Ifá-Lang supports both Yoruba and English. Use the toggle buttons above the code blocks to switch between languages!
Save the code to a file called hello.ifa, then run:
ifa run hello.ifa
Output:
Kaabo, Ifá!
Irosu has several output methods:
// Print with newline
Irosu.fo("Line 1");
Irosu.fo("Line 2");
// Print without newline
Irosu.so("Hello, ");
Irosu.so("World!");
Irosu.fo(""); // Add newline
// Print an error message (to stderr)
Irosu.kigbe("Something went wrong!");
// Print with newline
Fmt.println("Line 1");
Fmt.println("Line 2");
// Print without newline
Fmt.print("Hello, ");
Fmt.print("World!");
Fmt.println(""); // Add newline
// Print an error message (to stderr)
Fmt.error("Something went wrong!");
.ifa)Irosu.fo() / Printlnifa run