Cody

# Problem 2609. If-then-else

Solution 953520

Submitted on 1 Sep 2016 by Piotr Lis
• Size: 10
• This is the leading solution.
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 = 10; y_correct = 18; assert(isequal(if_then_else(x),y_correct))

y = 18 ans = []

2   Pass
x = 14; y_correct = 18; assert(isequal(if_then_else(x),y_correct))

y = 18 ans = []

3   Pass
x = 11; y_correct = 18; assert(isequal(if_then_else(x),y_correct))

y = 18 ans = []

4   Pass
x = 12; y_correct = 18; assert(isequal(if_then_else(x),y_correct))

y = 18 ans = []

5   Pass
x = 13; y_correct = 18; assert(isequal(if_then_else(x),y_correct))

y = 18 ans = []

6   Pass
x = 9; y_correct = 7; assert(isequal(if_then_else(x),y_correct))

y = 7 ans = []

7   Pass
x = 15; y_correct = 7; assert(isequal(if_then_else(x),y_correct))

y = 7 ans = []

8   Pass
x = 0; y_correct = 7; assert(isequal(if_then_else(x),y_correct))

y = 7 ans = []

9   Pass
x = 100; y_correct = 7; assert(isequal(if_then_else(x),y_correct))

y = 7 ans = []

10   Pass
x = -2; y_correct = 7; assert(isequal(if_then_else(x),y_correct))

y = 7 ans = []

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!