找回密码
 注册
搜索
查看: 15239|回复: 15

[心得体会] scope 觀念 + void setup and void draw

[复制链接]
发表于 2010-10-15 16:16:58 | 显示全部楼层 |阅读模式
ProcessingHandbook176.jpg Each program can have only one setup() and one draw(). When the program starts, the code outside of setup() and draw() is run. Next, the code inside the setup() block is run once. After that, the code inside the draw() block is run continuously until the program is stopped.Because the variable y is declared outside of setup() and draw(), it’s a global variable and can be accessed and assigned anywhere within the program. ProcessingHandbook1791.jpg Variables declared within setup() can be accessed only within the setup() block. Variables declared within draw() can be accessed only within the draw() block. The scope of a variable declared within a block,called a local variable, extends only to the end of the block. ProcessingHandbook1792.jpg When a variable is created within a block, it is destroyed when the program leaves the block. For example, if a new variable is created inside an if block, it can be used within but cannot be accessed outside the block. If a new variable is used to iterate through a for structure, it can be used within but cannot be accessed outside the block.

评分

参与人数 1强度 +3 照度 +30 收起 理由
skywoolf + 3 + 30 感谢分享

查看全部评分

 楼主| 发表于 2010-10-15 16:17:46 | 显示全部楼层
一些基本的概念...老實說看手冊就懂了,我也不知道為什麼還要發這個帖..
回复

使用道具 举报

 楼主| 发表于 2010-10-15 16:25:31 | 显示全部楼层
補充一下:可以重複命名的好處 Variable scope makes it possible to have more than one variable in a program with the same name. It’s common to use the same variable name for iterating over multiple for structures in one program, but in general, having more than one variable with the same name is not recommended.
回复

使用道具 举报

发表于 2010-10-15 16:36:05 | 显示全部楼层
支持了~我想这样的讲解多了可以促进大家的交流氛围~wei辛苦了!
回复

使用道具 举报

 楼主| 发表于 2010-10-15 16:39:15 | 显示全部楼层
恩 ! 晚點再發個function 的概念 一個好用的方法!!
回复

使用道具 举报

发表于 2010-10-16 00:53:26 | 显示全部楼层
好的,谢谢了!
回复

使用道具 举报

发表于 2010-10-22 10:35:50 | 显示全部楼层
受用了。。学习
回复

使用道具 举报

发表于 2010-10-31 18:56:37 | 显示全部楼层
很不错的东东哦
回复

使用道具 举报

发表于 2011-5-17 08:42:13 | 显示全部楼层
不错 up到前面
回复

使用道具 举报

发表于 2011-5-22 14:46:49 | 显示全部楼层
谢谢,楼主继续啊,最近在学processing,一些基本的概念就是缺乏,这样讲解就更清楚了。
回复

使用道具 举报

发表于 2011-5-24 13:56:37 | 显示全部楼层
泪奔~~~泪奔
回复

使用道具 举报

发表于 2011-5-24 14:43:51 | 显示全部楼层
学processing,一些基本的概念就是缺乏
回复

使用道具 举报

发表于 2011-5-29 07:44:34 | 显示全部楼层
fffffffffffffffffffffffffffffffffff
回复

使用道具 举报

发表于 2012-3-14 14:02:22 | 显示全部楼层
定~~~~~~~~~~~~~~~~
回复

使用道具 举报

发表于 2012-3-14 14:03:12 | 显示全部楼层
支持!~~~~~~~~~~~~~~~
回复

使用道具 举报

发表于 2012-3-15 00:54:00 | 显示全部楼层
支持!!!!
回复

使用道具 举报

NCFZ微信公众号

手机版|小黑屋|NCF参数化建筑论坛 ( 浙ICP备2020044100号-2 ) 辽公网安备21021102000973号

GMT+8, 2026-11-23 19:35 , Processed in 0.049674 second(s), 29 queries , Gzip On.

Powered by Discuz! X5.0 Licensed

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表