Disallow zeros
This commit is contained in:
parent
70df5770fb
commit
fccaf317d8
1 changed files with 11 additions and 1 deletions
12
src/main.rs
12
src/main.rs
|
@ -27,7 +27,17 @@ fn ticket_from_str(s: &str) -> Result<Ticket, anyhow::Error> {
|
|||
num5.unwrap()?,
|
||||
];
|
||||
|
||||
if r[0] > 90 || r[1] > 90 || r[2] > 90 || r[3] > 90 || r[4] > 90 {
|
||||
if r[0] < 1
|
||||
|| r[1] < 1
|
||||
|| r[2] < 1
|
||||
|| r[3] < 1
|
||||
|| r[4] < 1
|
||||
|| r[0] > 90
|
||||
|| r[1] > 90
|
||||
|| r[2] > 90
|
||||
|| r[3] > 90
|
||||
|| r[4] > 90
|
||||
{
|
||||
return Err(anyhow!("lotto number too high"));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue