>> assert(3==4,'Mismatch')
Mismatch
>> assert(3==3,'Mismatch')
>>
ADDENDUM:
Of course, you can make things more interesting by wrapping the assert inside a try...catch construct...
>> a=3;b=4;
>> try
assert(a==b,'')
catch
disp('Unequal')
end
Unequal
>>
Of course, what this gains over simply writing a straightforward if...else...end construct is difficult to see without context.
0 Comments
Sign in to comment.