Selection

This page is under construction. Please come back later.
#![allow(dead_code)]
#![allow(non_snake_case)]
#![allow(non_upper_case_globals)]
fn main() {
println!("Start...");
if args.len() != 3 {
println!("You need at least two command line arguments!");
}
println!("Finish...");
}
Output
$ rustc Selection1.rs
error[E0425]: cannot find value `args` in this scope
--> Selection1.rs:3:5
|
3 | if args.len() != 3 {
| ^^^^ not found in this scope
|
help: consider importing this function
|
1 + use std::env::args;
|
error: aborting due to previous error
For more information about this error, try `rustc --explain E0425`.
$ rustc Selection1.rs
error[E0425]: cannot find value `args` in this scope
--> Selection1.rs:3:5
|
3 | if args.len() != 3 {
| ^^^^ not found in this scope
|
help: consider importing this function
|
1 + use std::env::args;
|
error: aborting due to previous error
For more information about this error, try `rustc --explain E0425`.
#![allow(dead_code)]
#![allow(non_snake_case)]
#![allow(non_upper_case_globals)]
#[macro_use]
mod utils;
fn main() {
let x:isize = args[1].trim().parse::<i32>().unwrap_or(0);
println!("Start...");
if x > 10 {
println!("Greater than 10");
} else {
println!("Less than or equal to 10");
}
println!("Finish...");
}
Output
$ rustc Selection2.rs
error[E0425]: cannot find value `Utils` in this scope
--> Selection2.rs:4:16
|
4 | let x:isize = Utils.stoiWithDefault(args[1], 0);
| ^^^^^ not found in this scope
error[E0425]: cannot find value `args` in this scope
--> Selection2.rs:4:38
|
4 | let x:isize = Utils.stoiWithDefault(args[1], 0);
| ^^^^ not found in this scope
|
help: consider importing this function
|
1 + use std::env::args;
|
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0425`.
$ rustc Selection2.rs
error[E0425]: cannot find value `Utils` in this scope
--> Selection2.rs:4:16
|
4 | let x:isize = Utils.stoiWithDefault(args[1], 0);
| ^^^^^ not found in this scope
error[E0425]: cannot find value `args` in this scope
--> Selection2.rs:4:38
|
4 | let x:isize = Utils.stoiWithDefault(args[1], 0);
| ^^^^ not found in this scope
|
help: consider importing this function
|
1 + use std::env::args;
|
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0425`.
#![allow(dead_code)]
#![allow(non_snake_case)]
#![allow(non_upper_case_globals)]
#[macro_use]
mod utils;
fn main() {
let x:isize = args[1].trim().parse::<i32>().unwrap_or(0);
println!("Start...");
if x > 1000 {
println!("Greater than 1000");
} else if x > 100 {
println!("Greater than 100 but less than or equal to 1000");
} else {
println!("Less than or equal to 100");
}
println!("Finish...");
}
Output
$ rustc Selection3.rs
error[E0425]: cannot find value `Utils` in this scope
--> Selection3.rs:4:16
|
4 | let x:isize = Utils.stoiWithDefault(args[1], 0);
| ^^^^^ not found in this scope
error[E0425]: cannot find value `args` in this scope
--> Selection3.rs:4:38
|
4 | let x:isize = Utils.stoiWithDefault(args[1], 0);
| ^^^^ not found in this scope
|
help: consider importing this function
|
1 + use std::env::args;
|
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0425`.
$ rustc Selection3.rs
error[E0425]: cannot find value `Utils` in this scope
--> Selection3.rs:4:16
|
4 | let x:isize = Utils.stoiWithDefault(args[1], 0);
| ^^^^^ not found in this scope
error[E0425]: cannot find value `args` in this scope
--> Selection3.rs:4:38
|
4 | let x:isize = Utils.stoiWithDefault(args[1], 0);
| ^^^^ not found in this scope
|
help: consider importing this function
|
1 + use std::env::args;
|
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0425`.
$ rustc Selection3.rs
error[E0425]: cannot find value `Utils` in this scope
--> Selection3.rs:4:16
|
4 | let x:isize = Utils.stoiWithDefault(args[1], 0);
| ^^^^^ not found in this scope
error[E0425]: cannot find value `args` in this scope
--> Selection3.rs:4:38
|
4 | let x:isize = Utils.stoiWithDefault(args[1], 0);
| ^^^^ not found in this scope
|
help: consider importing this function
|
1 + use std::env::args;
|
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0425`.
#![allow(dead_code)]
#![allow(non_snake_case)]
#![allow(non_upper_case_globals)]
#[macro_use]
mod utils;
fn main() {
let x:isize = args[1].trim().parse::<i32>().unwrap_or(0);
match x {
1 => {
println!("One");
}
2 => {
println!("Two");
}
3|4 => {
println!("Three or Four");
}
_ => {
println!("Just don't know!");
}
}
}
Output
$ rustc Selection4.rs
error[E0425]: cannot find value `Utils` in this scope
--> Selection4.rs:4:16
|
4 | let x:isize = Utils.stoiWithDefault(args[1], 0);
| ^^^^^ not found in this scope
error[E0425]: cannot find value `args` in this scope
--> Selection4.rs:4:38
|
4 | let x:isize = Utils.stoiWithDefault(args[1], 0);
| ^^^^ not found in this scope
|
help: consider importing this function
|
1 + use std::env::args;
|
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0425`.
$ rustc Selection4.rs
error[E0425]: cannot find value `Utils` in this scope
--> Selection4.rs:4:16
|
4 | let x:isize = Utils.stoiWithDefault(args[1], 0);
| ^^^^^ not found in this scope
error[E0425]: cannot find value `args` in this scope
--> Selection4.rs:4:38
|
4 | let x:isize = Utils.stoiWithDefault(args[1], 0);
| ^^^^ not found in this scope
|
help: consider importing this function
|
1 + use std::env::args;
|
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0425`.
$ rustc Selection4.rs
error[E0425]: cannot find value `Utils` in this scope
--> Selection4.rs:4:16
|
4 | let x:isize = Utils.stoiWithDefault(args[1], 0);
| ^^^^^ not found in this scope
error[E0425]: cannot find value `args` in this scope
--> Selection4.rs:4:38
|
4 | let x:isize = Utils.stoiWithDefault(args[1], 0);
| ^^^^ not found in this scope
|
help: consider importing this function
|
1 + use std::env::args;
|
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0425`.
$ rustc Selection4.rs
error[E0425]: cannot find value `Utils` in this scope
--> Selection4.rs:4:16
|
4 | let x:isize = Utils.stoiWithDefault(args[1], 0);
| ^^^^^ not found in this scope
error[E0425]: cannot find value `args` in this scope
--> Selection4.rs:4:38
|
4 | let x:isize = Utils.stoiWithDefault(args[1], 0);
| ^^^^ not found in this scope
|
help: consider importing this function
|
1 + use std::env::args;
|
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0425`.
$ rustc Selection4.rs
error[E0425]: cannot find value `Utils` in this scope
--> Selection4.rs:4:16
|
4 | let x:isize = Utils.stoiWithDefault(args[1], 0);
| ^^^^^ not found in this scope
error[E0425]: cannot find value `args` in this scope
--> Selection4.rs:4:38
|
4 | let x:isize = Utils.stoiWithDefault(args[1], 0);
| ^^^^ not found in this scope
|
help: consider importing this function
|
1 + use std::env::args;
|
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0425`.
#![allow(dead_code)]
#![allow(non_snake_case)]
#![allow(non_upper_case_globals)]
#[macro_use]
mod utils;
fn main() {
let mut x:char = args[1][0];
x = tolower(x);
match x {
'a'|'e'|'i'|'o'|'u' => {
println!("{0} is a vowel", x as u32);
}
'y' => {
println!("y is sometimes a vowel");
}
_ => {
println!("{0} is a consonant", x as u32);
}
}
}
Output
$ rustc Selection5.rs
error: unknown format trait `c`
--> Selection5.rs:8:31
|
8 | println!("{}", format!("{0:c} is a vowel", u32(x)));
| ^
|
= note: the only appropriate formatting traits are:
- ``, which uses the `Display` trait
- `?`, which uses the `Debug` trait
- `e`, which uses the `LowerExp` trait
- `E`, which uses the `UpperExp` trait
- `o`, which uses the `Octal` trait
- `p`, which uses the `Pointer` trait
- `b`, which uses the `Binary` trait
- `x`, which uses the `LowerHex` trait
- `X`, which uses the `UpperHex` trait
error: unknown format trait `c`
--> Selection5.rs:14:31
|
14 | println!("{}", format!("{0:c} is a consonant", u32(x)));
| ^
|
= note: the only appropriate formatting traits are:
- ``, which uses the `Display` trait
- `?`, which uses the `Debug` trait
- `e`, which uses the `LowerExp` trait
- `E`, which uses the `UpperExp` trait
- `o`, which uses the `Octal` trait
- `p`, which uses the `Pointer` trait
- `b`, which uses the `Binary` trait
- `x`, which uses the `LowerHex` trait
- `X`, which uses the `UpperHex` trait
error[E0425]: cannot find value `args` in this scope
--> Selection5.rs:4:19
|
4 | let mut x:char = args[1][0];
| ^^^^ not found in this scope
|
help: consider importing this function
|
1 + use std::env::args;
|
error[E0425]: cannot find function `tolower` in this scope
--> Selection5.rs:5:6
|
5 | x = tolower(x);
| ^^^^^^^ not found in this scope
error[E0423]: expected function, found builtin type `u32`
--> Selection5.rs:8:47
|
8 | println!("{}", format!("{0:c} is a vowel", u32(x)));
| ^^^ not a function
error[E0423]: expected function, found builtin type `u32`
--> Selection5.rs:14:51
|
14 | println!("{}", format!("{0:c} is a consonant", u32(x)));
| ^^^ not a function
error: aborting due to 6 previous errors
Some errors have detailed explanations: E0423, E0425.
For more information about an error, try `rustc --explain E0423`.
$ rustc Selection5.rs
error: unknown format trait `c`
--> Selection5.rs:8:31
|
8 | println!("{}", format!("{0:c} is a vowel", u32(x)));
| ^
|
= note: the only appropriate formatting traits are:
- ``, which uses the `Display` trait
- `?`, which uses the `Debug` trait
- `e`, which uses the `LowerExp` trait
- `E`, which uses the `UpperExp` trait
- `o`, which uses the `Octal` trait
- `p`, which uses the `Pointer` trait
- `b`, which uses the `Binary` trait
- `x`, which uses the `LowerHex` trait
- `X`, which uses the `UpperHex` trait
error: unknown format trait `c`
--> Selection5.rs:14:31
|
14 | println!("{}", format!("{0:c} is a consonant", u32(x)));
| ^
|
= note: the only appropriate formatting traits are:
- ``, which uses the `Display` trait
- `?`, which uses the `Debug` trait
- `e`, which uses the `LowerExp` trait
- `E`, which uses the `UpperExp` trait
- `o`, which uses the `Octal` trait
- `p`, which uses the `Pointer` trait
- `b`, which uses the `Binary` trait
- `x`, which uses the `LowerHex` trait
- `X`, which uses the `UpperHex` trait
error[E0425]: cannot find value `args` in this scope
--> Selection5.rs:4:19
|
4 | let mut x:char = args[1][0];
| ^^^^ not found in this scope
|
help: consider importing this function
|
1 + use std::env::args;
|
error[E0425]: cannot find function `tolower` in this scope
--> Selection5.rs:5:6
|
5 | x = tolower(x);
| ^^^^^^^ not found in this scope
error[E0423]: expected function, found builtin type `u32`
--> Selection5.rs:8:47
|
8 | println!("{}", format!("{0:c} is a vowel", u32(x)));
| ^^^ not a function
error[E0423]: expected function, found builtin type `u32`
--> Selection5.rs:14:51
|
14 | println!("{}", format!("{0:c} is a consonant", u32(x)));
| ^^^ not a function
error: aborting due to 6 previous errors
Some errors have detailed explanations: E0423, E0425.
For more information about an error, try `rustc --explain E0423`.
$ rustc Selection5.rs
error: unknown format trait `c`
--> Selection5.rs:8:31
|
8 | println!("{}", format!("{0:c} is a vowel", u32(x)));
| ^
|
= note: the only appropriate formatting traits are:
- ``, which uses the `Display` trait
- `?`, which uses the `Debug` trait
- `e`, which uses the `LowerExp` trait
- `E`, which uses the `UpperExp` trait
- `o`, which uses the `Octal` trait
- `p`, which uses the `Pointer` trait
- `b`, which uses the `Binary` trait
- `x`, which uses the `LowerHex` trait
- `X`, which uses the `UpperHex` trait
error: unknown format trait `c`
--> Selection5.rs:14:31
|
14 | println!("{}", format!("{0:c} is a consonant", u32(x)));
| ^
|
= note: the only appropriate formatting traits are:
- ``, which uses the `Display` trait
- `?`, which uses the `Debug` trait
- `e`, which uses the `LowerExp` trait
- `E`, which uses the `UpperExp` trait
- `o`, which uses the `Octal` trait
- `p`, which uses the `Pointer` trait
- `b`, which uses the `Binary` trait
- `x`, which uses the `LowerHex` trait
- `X`, which uses the `UpperHex` trait
error[E0425]: cannot find value `args` in this scope
--> Selection5.rs:4:19
|
4 | let mut x:char = args[1][0];
| ^^^^ not found in this scope
|
help: consider importing this function
|
1 + use std::env::args;
|
error[E0425]: cannot find function `tolower` in this scope
--> Selection5.rs:5:6
|
5 | x = tolower(x);
| ^^^^^^^ not found in this scope
error[E0423]: expected function, found builtin type `u32`
--> Selection5.rs:8:47
|
8 | println!("{}", format!("{0:c} is a vowel", u32(x)));
| ^^^ not a function
error[E0423]: expected function, found builtin type `u32`
--> Selection5.rs:14:51
|
14 | println!("{}", format!("{0:c} is a consonant", u32(x)));
| ^^^ not a function
error: aborting due to 6 previous errors
Some errors have detailed explanations: E0423, E0425.
For more information about an error, try `rustc --explain E0423`.
$ rustc Selection5.rs
error: unknown format trait `c`
--> Selection5.rs:8:31
|
8 | println!("{}", format!("{0:c} is a vowel", u32(x)));
| ^
|
= note: the only appropriate formatting traits are:
- ``, which uses the `Display` trait
- `?`, which uses the `Debug` trait
- `e`, which uses the `LowerExp` trait
- `E`, which uses the `UpperExp` trait
- `o`, which uses the `Octal` trait
- `p`, which uses the `Pointer` trait
- `b`, which uses the `Binary` trait
- `x`, which uses the `LowerHex` trait
- `X`, which uses the `UpperHex` trait
error: unknown format trait `c`
--> Selection5.rs:14:31
|
14 | println!("{}", format!("{0:c} is a consonant", u32(x)));
| ^
|
= note: the only appropriate formatting traits are:
- ``, which uses the `Display` trait
- `?`, which uses the `Debug` trait
- `e`, which uses the `LowerExp` trait
- `E`, which uses the `UpperExp` trait
- `o`, which uses the `Octal` trait
- `p`, which uses the `Pointer` trait
- `b`, which uses the `Binary` trait
- `x`, which uses the `LowerHex` trait
- `X`, which uses the `UpperHex` trait
error[E0425]: cannot find value `args` in this scope
--> Selection5.rs:4:19
|
4 | let mut x:char = args[1][0];
| ^^^^ not found in this scope
|
help: consider importing this function
|
1 + use std::env::args;
|
error[E0425]: cannot find function `tolower` in this scope
--> Selection5.rs:5:6
|
5 | x = tolower(x);
| ^^^^^^^ not found in this scope
error[E0423]: expected function, found builtin type `u32`
--> Selection5.rs:8:47
|
8 | println!("{}", format!("{0:c} is a vowel", u32(x)));
| ^^^ not a function
error[E0423]: expected function, found builtin type `u32`
--> Selection5.rs:14:51
|
14 | println!("{}", format!("{0:c} is a consonant", u32(x)));
| ^^^ not a function
error: aborting due to 6 previous errors
Some errors have detailed explanations: E0423, E0425.
For more information about an error, try `rustc --explain E0423`.
$ rustc Selection5.rs
error: unknown format trait `c`
--> Selection5.rs:8:31
|
8 | println!("{}", format!("{0:c} is a vowel", u32(x)));
| ^
|
= note: the only appropriate formatting traits are:
- ``, which uses the `Display` trait
- `?`, which uses the `Debug` trait
- `e`, which uses the `LowerExp` trait
- `E`, which uses the `UpperExp` trait
- `o`, which uses the `Octal` trait
- `p`, which uses the `Pointer` trait
- `b`, which uses the `Binary` trait
- `x`, which uses the `LowerHex` trait
- `X`, which uses the `UpperHex` trait
error: unknown format trait `c`
--> Selection5.rs:14:31
|
14 | println!("{}", format!("{0:c} is a consonant", u32(x)));
| ^
|
= note: the only appropriate formatting traits are:
- ``, which uses the `Display` trait
- `?`, which uses the `Debug` trait
- `e`, which uses the `LowerExp` trait
- `E`, which uses the `UpperExp` trait
- `o`, which uses the `Octal` trait
- `p`, which uses the `Pointer` trait
- `b`, which uses the `Binary` trait
- `x`, which uses the `LowerHex` trait
- `X`, which uses the `UpperHex` trait
error[E0425]: cannot find value `args` in this scope
--> Selection5.rs:4:19
|
4 | let mut x:char = args[1][0];
| ^^^^ not found in this scope
|
help: consider importing this function
|
1 + use std::env::args;
|
error[E0425]: cannot find function `tolower` in this scope
--> Selection5.rs:5:6
|
5 | x = tolower(x);
| ^^^^^^^ not found in this scope
error[E0423]: expected function, found builtin type `u32`
--> Selection5.rs:8:47
|
8 | println!("{}", format!("{0:c} is a vowel", u32(x)));
| ^^^ not a function
error[E0423]: expected function, found builtin type `u32`
--> Selection5.rs:14:51
|
14 | println!("{}", format!("{0:c} is a consonant", u32(x)));
| ^^^ not a function
error: aborting due to 6 previous errors
Some errors have detailed explanations: E0423, E0425.
For more information about an error, try `rustc --explain E0423`.
Questions
- {{Who's on first?}}
- {{Who's on second?}}
- {{Who's on third?}}
Projects
More ★'s indicate higher difficulty level.
- FICA Taxes (Revisited)
- FICA Taxes (Empoyee and Employer)
- Football Passer Rating (NFL and NCAA)
- Income Tax (Single Taxpayer)
- Income Tax
- Pythagorean Theorem
- Retirement Calculator
References
- [[Rust Language Reference]]
- [[Rust Compiler]]
Pure Programmer


