麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 學院 > 開發設計 > 正文

ChucK初步(8)

2019-11-14 09:22:30
字體:
來源:轉載
供稿:網友

functions

writingcallingoverloading

writing(書寫)

keyWord fun (or function) followed by the return type and then the name of the function. After the name of the function parentheses(括號) must be opened to declare the types of the input arguments.

// define function call 'funk' fun void funk( int arg ) { // insert code here } // define function 'addOne' fun int addOne(int x) { // result return x + 1; }

calling(調用)

// define 'hey' fun int hey( int a, int b ) { // do something return a + b; } // call the function; store result hey( 1, 2 ) => int result;

You can also use the ChucK Operator to call functions!

// call hey ( 1, 2 ) => hey => int result; // same hey( 1, 2 ) => int result; // several in a row ( 10, 100 ) => Std.rand2 => Std.mtof => float foo; // same 返回值做參數 Std.mtof( Std.rand2( 10, 100 ) ) => float foo;

overloading(重載)

Overloading a function allows functions with the same name to be defined(定義) with different arguments. The function must be written in separate instances(實例) to handle the input, and the return type must agree(一致).

// funk( int ) fun int add(int x) { return x + x; } // funk( int, int ) fun int add(int x, int y) { return x + y; } // compiler automatically choose the right one to call add( 1 ) => int foo; add( 1, 2 ) => int bar;
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 日本一区二区三区视频在线 | 国产一区二区三区手机在线 | www.99热精品| 久久精品国产久精国产 | 五月天堂婷婷 | 毛片在哪里看 | 中文字幕在线观看二区 | 特片网久久 | 欧美成在线视频 | 亚洲影视在线 | 看a级毛片| 久久久精品视频免费看 | h视频在线免费观看 | 黄视频网站免费观看 | 中国黄色一级生活片 | 4p嗯啊巨肉寝室调教男男视频 | 亚洲一区二区中文 | 91精品国产乱码久久久久久久久 | 久草网在线 | 日韩视频网址 | 91久久久久 | 国产一级片91 | 国产精品久久久久久久久久尿 | 手机av免费电影 | 欧美性生活久久 | 国产精品久久久久久久久久久久午夜 | 久久色播 | 亚洲成人欧美在线 | 国产精品观看在线亚洲人成网 | 久久在草 | 成人小视频在线播放 | 欧美乱论 | 天天操很很操 | 日韩视频在线一区二区三区 | 久久男人天堂 | 欧美一级毛片欧美一级成人毛片 | 成人免费av在线 | 91精品国啪老师啪 | 亚洲va久久久噜噜噜久久男同 | 国产精品一区在线观看 | 色人阁五月天 |