mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-01-10 12:49:18 +00:00
parent
9f61db5dbe
commit
ace380fd5d
@ -15,7 +15,7 @@ struct Package {
|
|||||||
impl Package {
|
impl Package {
|
||||||
fn new(sender_country: String, recipient_country: String, weight_in_grams: i32) -> Package {
|
fn new(sender_country: String, recipient_country: String, weight_in_grams: i32) -> Package {
|
||||||
if weight_in_grams <= 0 {
|
if weight_in_grams <= 0 {
|
||||||
// Something goes here...
|
panic!("Can not ship a weightless package.")
|
||||||
} else {
|
} else {
|
||||||
return Package {sender_country, recipient_country, weight_in_grams};
|
return Package {sender_country, recipient_country, weight_in_grams};
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user