Data(数据)


变量,可以理解为一个存储内容的名字。在现实中我们有时会从1数到100,下面我们就试着用变量来数数
点击按钮,在弹出的窗体里输入变量的名字count,再点击OK按钮。之后左边就会出现与之相关的模块了,从下到下的意思分别是,(在展示区)显示/隐藏变量;把变量值设置为0;将变量值增加1;显示变量内容;隐藏变量内容。
右边脚本的意思,第1步,将变量值设置为0,将变量值增加1,等待0.1秒钟,将变量值增加1,再等待0.1秒……一直这样增加下去。执行右边的脚本块,会看到左上角的count值会一起变化,每隔0.1秒增加1

2. Make a List,设置一个列表
列表,可以理解为一组同类的内容,比如一个年级的班级,【1班、2班、3班、4班】,或者一个学期的课程,【数学、语文、英语、美术】
点击Make a List按钮,在弹出的窗口里输入名字“course”,点击OK按钮完成,就会出现下图的内容,再点击左边的“+”号,分别输入【数学、语文、英语、美术】

完成之后,就会像下图这个样子了。可点击红框处的“x”删除没用的内容
2.1 course,显示/隐藏列表内容

2.2 add thing to course,将“thing”添加到列表最后

2.3 delete (...) of course
2.3.1 delete 1 of course,将列表第1条内容删除,此时就是删除“数学”;如果将1改成3,那就是删除“英语”,删除之后,美术变成3,thing变成4
2.3.2 delete last of course,删除列表的最后一项内容
2.3.3 delete all of course,把列表里的内容全部删除
2.4 insert thing at (...) of course
2.4.1 insert thing at 1 of course,在1处添加新的内容,后面的内容顺序下移;如果数字改为3,那么就是添加到原来3-英语的位置,英语就变成了4,美术变为5,thing变为6

2.4.2 insert thing at last of course,在列表最后添加新内容
2.4.3 insert thing at random of course,在列表的随机位置添加新内容
2.5 replace item 1 of course with thing,把第1条内容用thing替换
同样,这个脚本也有replace item 'last' of course with thing, replace item 'random' of course with thing,意思跟2.4的类似
2.6 item 1 of course,列表第1项的内容
看下图就能很容易地了解了。

2.7 length of course,列表内容的长度,也就是列表里有多少条内容
2.8 course contains thing? 判断列表里是否包含thing,此时小猫说“是”

我把“thing”改成“math”,此时小猫就说“不是”了

2.9 show/hide list course,显示/隐藏course列表
网友评论