Press â or â to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
Range expressionsThe ..
and ..=
operators will construct an object of one of the std::ops::Range
(or core::ops::Range
) variants, according to the following table:
Examples:
#![allow(unused)] fn main() { 1..2; // std::ops::Range 3..; // std::ops::RangeFrom ..4; // std::ops::RangeTo ..; // std::ops::RangeFull 5..=6; // std::ops::RangeInclusive ..=7; // std::ops::RangeToInclusive }
The following expressions are equivalent.
#![allow(unused)] fn main() { let x = std::ops::Range {start: 0, end: 10}; let y = 0..10; assert_eq!(x, y); }
Ranges can be used in for
loops:
#![allow(unused)] fn main() { for i in 1..11 { println!("{}", i); } }
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4