比如下面这段普通简单的A+B Problem的代码(MATLAB):
function solve_AplusB_problem
disp('This is a programme for solving A+B problem');
A=input('Please input the fist number A:');
B=input('Please input the second number B:');
C=A+B;
str=['The result of A+B is:',num2str(C)];
disp(str);
复制代码
这段代码再简单不过,当年的我可能也差不多类似于上面那样写代码,但现在的我就会这样来写:
function solve_AplusB_problem
% by faruto
% a test programme for solving A+B problem
disp('This is a programme for solving A+B problem');