Language / Numeric literals

Numeric literals

Silk supports integer and floating-point literals, including base prefixes suffixes as defined in the canonical spec.

Full reference: literals numeric.

Example#

fn main () -> int {
  let a: int = 42;
  let b: u64 = 0xff as u64;
  let c: f64 = 1.5;
  if a + (b as int) > 0 && c > 0.0 {
    return 0;
  }
  return 1;
}

See also#

Source repository · Edit this page · View Markdown