?`gbè 1111

The Foundation — System/Lifecycle

Type introspection, assertions, parsing

Methods

type / iru

Ogbe.type(value) ? String

Get the type name of a value.

ayanmo x = 42;
Irosu.fo(Ogbe.type(x));    // "int"

ayanmo s = "hello";
Irosu.fo(Ogbe.type(s));    // "string"

ayanmo list = [1, 2, 3];
Irosu.fo(Ogbe.type(list)); // "list"

len / gigun

Ogbe.len(value) ? Int

Get the length of a value (string chars, list items, etc.).

Irosu.fo(Ogbe.len("Ifá"));     // 3
Irosu.fo(Ogbe.len([1,2,3,4])); // 4

assert / j?ri

Ogbe.assert(condition, [message]) ? Bool

Assert a condition is true, throw error if false.

Ogbe.assert(x > 0, "x must be positive");
Ogbe.j?ri(list.len() > 0, "List cannot be empty");

format / ??da

Ogbe.format(values...) ? String

Format values into a string.

ayanmo msg = Ogbe.format("User:", name, "Age:", age);
Irosu.fo(msg);

parse_int

Ogbe.parse_int(value) ? Int

Parse a string to integer.

ayanmo n = Ogbe.parse_int("42");
Irosu.fo(n + 8);  // 50

parse_float

Ogbe.parse_float(value) ? Float

Parse a string to float.

ayanmo f = Ogbe.parse_float("3.14");
Irosu.fo(f * 2);  // 6.28