THE JOA LANGUAGE

Subnet Methods

Joa subnet reference: network and mask properties, CIDR splitting, IP containment, and prefix validation.

Method / Property Returns Description
subnet.network String Network address string (e.g. "192.168.1.0")
subnet.mask Integer Prefix length (e.g. 24)
subnet.split(prefix) List Splits into all equal /prefix sub-networks
subnet.contains(ip) Bool Whether the given IP is inside the subnet
let zone = 10.0.0.0/8

print(zone.network)          // 10.0.0.0
print(zone.mask)             // 8

// Split into /10 subnets
let quarters = zone.split(10)
print(quarters[0])           // 10.0.0.0/10
print(quarters[1])           // 10.64.0.0/10

// Membership via method
print(zone.contains(10.5.1.2))   // true

split() Type Safety

The prefix argument must be an Integer. Passing a String raises a Type Error with a hint:

zone.split("10")
// ❌ Type Error: subnet.split() requires an Integer CIDR prefix (e.g. split(28)).
// 💡 Hint: Remove quotes if you used a string: split(28) not split("28").