x = 10;
switch mod(x, 4)
    case 0
        x + 1
    case {1, 2}
        x * 2
    otherwise
        x ^ 3
end
x = 10;
if x < 10 && ~mod(x, 2)
    x + 1
elseif ~mod(x, 3)
    x * 2
else
    x ^ 3
end
x = 0; y = 1; z = 2;
if x && ~y && z
    x
elseif x || ~y || z
    y
else
    z
end
log1()
log1(1)
log1(2, 4)
log2(1)
log2(1, exp(1))
log2(1, exp(1), exp(2))
f1(0)
f1(2)
f1(5)
f2([1, 2, 3], 4)
f2([1, 2, 3], 2)
f2([1, 2, 3])
fib(5)
combin(3, 2)
gcd(10, 6)
gcd(9, 16)
function z = log1(x, y)
    switch nargin
        case 1
            z = log(x);
        case 2
            z = log(y) / log(x);
        otherwise
            z = 1;
    end
end
function z = log2(x, varargin)
    if nargin == 1
        z = log(x);
    else
        z = [log(x) zeros(1, nargin - 1)];
        for t = 2:nargin
            z(t) = log(varargin{t - 1});
        end
    end
end
function z = f1(x)
    if ~x
        z = 1;
    else
        z = x * f1(x - 1);
    end
end
function z = f2(x, t)
    if nargin == 1
        z = f2(x, 1);
    elseif t > length(x)
        z = 0;
    else
        z = x(t) + f2(x, t + 1);
    end
end
function z = fib(x)
    if x < 3
        z = 1;
    else
        z = fib(x - 1) + fib(x - 2);
    end
end
function z = combin(x, y)
    if x == 1 || y == 1
        z = 1;
    else
        z = combin(x - 1, y - 1) + combin(x - 1, y);
    end
end
function z = gcd(x, y)
    if ~y
        z = x;
    else
        z = gcd(y, mod(x, y));
    end
end