MATLAB Fundamentals>>>(2/2) Reserved Keywords MATKAB保留关键字有哪些?

MATLAB Fundamentals>Programming Constructs>Course Example - Comparing Prices>(2/2) Reserved Keywords


任务1:

Keywords are reserved words with special meanings.

To see a list of MATLAB programming keywords, type:iskeyword

解答1:

iskeyword

结果1:关键字一共20个,如下

'break'
'case'
'catch'
'classdef'
'continue'
'else'
'elseif'
'end'
'for'
'function'
'global'
'if'
'otherwise'
'parfor'
'persistent'
'return'
'spmd'
'switch'
'try'
'while'

附加练习:

MATLAB programs can make use of keywords to control execution of the code. Keywords are the basic programming components of the MATLAB language. You can use them to build programming constructs that allow your programs to make decisions or repeat a procedure multiple times. Use these constructs to make your code more robust, more flexible, and more maintainable.

MATLAB will not allow you to use a keyword as a variable.

end = pi
end = pi
    ↑
Error: Illegal use of reserved keyword "end".

笔记:

MATLAB程序可以利用关键字来控制代码的执行。关键字是MATLAB语言的基本编程组件。您可以使用它们来构建编程结构,使您的程序能够多次做出决策或重复一个过程。使用这些构造可以使代码更健壮、更灵活、更易于维护。
MATLAB不允许您将关键字用作变量。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值