T Trang Mắm New member Sep 19, 2021 #1 What is the output of the following code? Code: function [die,af] = lola(y,x) die = y*x; if nargout < 1 error('Boo !') else disp(‘Yo !’) af = abs(die); end end p=lola(1,[1 -2]) A. Error with Boo ! written B. Yo ! p=-2 C. Boo ! p=-1 D. Boo ! p=1
What is the output of the following code? Code: function [die,af] = lola(y,x) die = y*x; if nargout < 1 error('Boo !') else disp(‘Yo !’) af = abs(die); end end p=lola(1,[1 -2]) A. Error with Boo ! written B. Yo ! p=-2 C. Boo ! p=-1 D. Boo ! p=1
T ThịThúy Hiền New member Sep 19, 2021 #2 Answer: a Explanation: Since the number of argument sought are less than 1, nargout is less than 1 and the if condition is satisfied so the function terminates with an error. Upvote 0 Downvote
Answer: a Explanation: Since the number of argument sought are less than 1, nargout is less than 1 and the if condition is satisfied so the function terminates with an error.