开发者

meaning of this statement?

开发者 https://www.devze.com 2023-01-03 17:06 出处:网络
In a Pascal program, what does statement s1:=[0,3,7]开发者_如何学Python mean ?s1 is a Pascal set variable, and it is being initialised so that the set contains the members 0, 3 and 7.Pascal has first-

In a Pascal program, what does statement s1:=[0,3,7]开发者_如何学Python mean ?


s1 is a Pascal set variable, and it is being initialised so that the set contains the members 0, 3 and 7.


Pascal has first-class support for sets. s1 is presumably declared as a set, like

var  s1 : set of 0..10;

You can then write

if i in s1
// true when i is 0, 3 or 7
0

精彩评论

暂无评论...
验证码 换一张
取 消