Files
bux-lang/examples/enums.bux
T
dimgigov 92c5cd59f5 refactor: migrate examples to import Std::Io instead of raw extern func
- Create stdlib/Std/Io.bux with extern func declarations
- Rename C shim functions to short names (PrintLine, PrintInt, etc.)
- Update all 9 examples to use import Std::Io::{PrintLine, PrintInt};
- Remove manual extern func Std_Io_* declarations from examples
2026-05-31 02:01:28 +03:00

35 lines
574 B
Plaintext

// Enums - Enumeration types
import Std::Io::{PrintLine, PrintInt};
enum Color {
Red,
Green,
Blue
}
func ColorName(c: Color) -> String {
if c == Color::Red {
return "Red";
}
if c == Color::Green {
return "Green";
}
if c == Color::Blue {
return "Blue";
}
return "Unknown";
}
func Main() -> int {
let myColor: Color = Color::Green;
PrintLine("My color is:");
PrintLine(ColorName(myColor));
PrintLine("Color value:");
PrintInt(myColor as int);
PrintLine("");
return 0;
}