mirror of
https://git.aramjonghu.dev/AramJonghu/ziglings.git
synced 2026-09-01 08:03:29 +02:00
progress
This commit is contained in:
@@ -59,7 +59,12 @@ fn fixTooSmall(n: u32) MyNumberError!u32 {
|
||||
// If we get a TooSmall error, we should return 10.
|
||||
// If we get any other error, we should return that error.
|
||||
// Otherwise, we return the u32 number.
|
||||
return detectProblems(n) ???;
|
||||
return detectProblems(n) catch |err| {
|
||||
if (err == MyNumberError.TooSmall) {
|
||||
return 10;
|
||||
}
|
||||
return err;
|
||||
};
|
||||
}
|
||||
|
||||
fn detectProblems(n: u32) MyNumberError!u32 {
|
||||
|
||||
@@ -26,7 +26,7 @@ fn addFive(n: u32) MyNumberError!u32 {
|
||||
// This function needs to return any error which might come back from detect().
|
||||
// Please use a "try" statement rather than a "catch".
|
||||
//
|
||||
const x = detect(n);
|
||||
const x = try detect(n);
|
||||
|
||||
return x + 5;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user