It is easy to dynamically obtain the number of output variables in MATLAB by function “nargout”，how can I do such in Julia?
For example,these is the code in MATLAB

function [ varargout ] = CopyElement( V )
% V is a tensor, varargout copy its element value
if( nargout > numel( V ) )
error( 'In CopyElement: the number of elements in V should no less than nargout!' );
end
for i = 1 : nargout
varargout{ i } = V( i );
end
end

In Julia, multiple values are returned and assigned as tuples, e.g. (a, b) = (1, 2) or a, b = 1, 2. MATLAB’s nargout, which is often used in MATLAB to do optional work based on the number of returned values, does not exist in Julia. Instead, users can use optional and keyword arguments to achieve similar capabilities.