-
1 Comment
Suggested Solutions reminds me lambda expressions in C++ or Java. And i agree regexp misusage is truly hiding the code in MATLAB build in functions. The size = 10 is misleading, since unwrapping the if condition, can never be lesser than a single line function, like this
function tf = is_it_odd(n)
tf = mod( n, 2 ) == 1;
end
Obviously no if environment is called and an explicitly assignment is in this case totally not needed, hence mod is returning a value (type: @logical).
Further this expression cannot work without any explicit assignment command for the output result.
My strict recommendation for MATLAB newbies to ignore such statements. It is truly not good practice and me as Software Developer would directly reject such solutions.
Suggested Problems
-
7725 Solvers
-
386 Solvers
-
9478 Solvers
-
Duplicate each element of a vector.
616 Solvers
-
384 Solvers
More from this Author96
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!