Cody

# Problem 3107. Try and Catch Simple Example

Solution 1005528

Submitted on 10 Oct 2016 by Jakub Mrowka
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
x = [1 4 6 8 10]; n=1; y_correct = 1; assert(isequal(trcatch(x,n),y_correct))

n = 1

2   Pass
filetext = fileread('trcatch.m'); assert(~isempty(strfind(filetext, 'try')),'try missing') assert(~isempty(strfind(filetext, 'catch')),'Catch missing')

3   Pass
x = [1 4 6 8 10]; n=0; y_correct = 0; assert(isequal(trcatch(x,n),y_correct))

n = 0

4   Pass
x = [1 4 6 8 10]; n=6; y_correct = 0; assert(isequal(trcatch(x,n),y_correct))

n = 6

5   Pass
x = [1 4 6 8 10]; n=5; y_correct = 10; assert(isequal(trcatch(x,n),y_correct))

n = 5

6   Pass
x = [1 4 6 8 10]; n=-25; y_correct = 0; assert(isequal(trcatch(x,n),y_correct))

n = -25

7   Pass
x = [1 4 6 8 10]; n=3; y_correct = 6; assert(isequal(trcatch(x,n),y_correct))

n = 3