OxL Reference

method Flag.percent

On for p percent (0..100) of the users (by), plus the allow list, minus the deny list.

Example:

oxl✓ checked in CI
fn main() io {
  let vip = Flag.percent(0, allow: ["u7"], deny: ["u8"])
  let u7 = Principal.User("u7", [], Map.new(), false, none)
  let u8 = Principal.User("u8", [], Map.new(), false, none)
  print("{vip.on(r#for: u7)} {vip.on(r#for: u8)}")
}
Output
true false
pub(api) static fn percent(p: f64, by: FlagBy = .User, allow: List<str> = [], deny: List<str> = []) -> Flag

Complexity. O(1).

Since. 1.0.0-beta

Parameters

NameType
pf64
byFlagBy = .User
allowList<str> = []
denyList<str> = []

Returns

Flag

Effects

none declared (pure unless the body says otherwise)

Defined in: std/core/dynconf.oxl:759

See also