function result = lineOfx(howMany) %lineOfx return a string made up of the letter x (howMany times) % % consumes: howMany, a scalar number indicating how many times % the letter x should appear % produces: a string made up of the letter x that many times % % if x <= 0, an empty string is returned % % Examples: % >> lineOfx(3) % ans = % xxx % >> lineOfx(5) % ans = % xxxxx % >> lineOfx(-10) % ans = % '' % >> % P. Conrad for CISC106, 10/07/2007 result = ''; for i=1:howMany result = [ result 'x' ]; end; return; end % function lineOfx