NCF参数化建筑论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 9284|回复: 7
打印 上一主题 下一主题

[心得体会] Compare coding with function or not.

[复制链接]
跳转到指定楼层
1m
发表于 2010-10-15 18:00:24 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 weiwei 于 2010-10-15 18:14 编辑 Because it takes 6 lines to draw each shape, we now have 12 lines. Drawing our desired pattern that uses 6 shapes will require 36 lines of code. Imagine if we wanted to draw 30 eyes—the code inside draw() would bloat to 180 lines. 在此提及到如果每個圖形都單圖控制,會造成程式的冗長。並且不好修改。

评分

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

查看全部评分

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享
2m
 楼主| 发表于 2010-10-15 18:12:55 | 只看该作者
Multiple functions can have the same name, as long as they have different parameters.Creating different functions with the same name is called function overloading, and it’s what allows Processing to have more than one version of functions like fill(),image(), and text(), each with different parameters. A program can also have two functions with the same number of parameters, but only if the data type for one of the parameters is different. 需要注意的是,function可以同樣命名處理不同的功能,但裡面的參數必須不一樣。
3m
发表于 2010-10-15 19:12:30 | 只看该作者
可以处理value,需要定义function的返回值的种类,最后结束时return需要返回的值 void就是没有返回值
4m
 楼主| 发表于 2010-10-15 19:31:57 | 只看该作者
嗯嗯 多謝claudemit 的補充!! 如果要value 的就必須加上return 還有資料型態data type
5m
发表于 2010-10-16 00:36:05 | 只看该作者
楼主能给个邮箱么(注册用户,没法发站内信的= =),目前和我的设计老师在做arduino相关,可以交流下么~~多谢了~~
6m
发表于 2010-10-16 11:48:39 | 只看该作者
很精彩, 努力学习,看懂理解,
7m
 楼主| 发表于 2010-10-16 19:02:51 | 只看该作者
5# wyj900817 我已經發郵箱 給你了,你去站內收短消息巴。
8m
发表于 2010-12-24 15:43:20 | 只看该作者
nice thanks

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

GMT+8, 2024-4-25 20:55 , Processed in 0.344206 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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