Skip to content
Oro Computer logooro
Runtime Silk Virtnosis Blog Docs Contact
Inside
Silk
Overview Learn Docs Spec Wiki
Silk Wiki
Start
  • Silk Wiki
Language
  • Syntax tour
  • Cheat sheet
  • Flow control overview
  • if / else
  • match
  • loop
  • while
  • for loops
  • break
  • continue
  • return
  • Expression statements
  • Blocks and statements
  • Grammar
  • Doc comments
  • Packages, imports, and exports
  • Types
  • Optionals (T?)
  • Mutability (mut)
  • Operators
  • Literals
  • Numeric literals
  • String literals
  • Character literals
  • Boolean literals
  • Duration literals
  • Duration and Instant
  • Aggregate literals (arrays and structs)
  • Structs and impl
  • Struct requirements (#require)
  • Interfaces
  • Enums
  • Errors and assertions
  • Typed errors (error, panic, and T | ErrorType...)
  • Borrow checker (design)
  • Memory model
  • Regions (with)
  • Buffers (Buffer(T)) (design)
  • Concurrency (async, task, await, yield)
  • Function disciplines (pure, async, task)
  • Const Functions (const fn)
  • Generics (monomorphized)
  • Varargs (...args)
  • External declarations (ext)
  • Testing (test)
  • Formal verification (Formal Silk)
  • Dependent types (const parameters) (design)
  • Conventions
Standard library
  • Standard library overview (std::)
  • std:: conventions
  • std:: package structure
  • std::interfaces
  • std::result
  • std::io
  • std::fmt
  • std::strings
  • std::arrays
  • std::vector
  • std::map
  • std::set
  • std::buffer
  • std::bits
  • std::algorithms
  • std::memory
  • std::args
  • std::env
  • std::process
  • std::path
  • std::fs
  • std::json
  • std::toml
  • std::url
  • std::semver
  • std::uuid
  • std::net
  • std::crypto
  • std::tls
  • std::runtime
  • std::task
  • std::sync
  • std::temporal
  • std::formal
Language / while

while

Use while for condition-controlled looping.

Full reference: flow while.

Notes#

  • Supported forms + tests: flow while

Syntax#

while condition {
  // ...
}

Example#

fn main () -> int {
  let mut i: int = 0;
  let mut sum: int = 0;

  while i < 3 {
    sum += i;
    i += 1;
  }

  return sum; // 0 + 1 + 2 = 3
}

See also#

  • Full reference: flow while
  • break / continue: flow break, flow continue

Source repository · Edit this page · View Markdown

Previousloop
Nextfor loops
On this page
  • Notes
  • Syntax
  • Example
  • See also
Silk Wiki
© 2026 Oro Computer. Edit this page