-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
58972d1
commit 1c3c5cc
Showing
52 changed files
with
1,109 additions
and
1,174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,4 +22,4 @@ Webduino Bit 在线标准版 | |
photocell | ||
temperature | ||
buzzer | ||
mpu9250 | ||
mpu9250 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,4 +13,4 @@ | |
:numbered: | ||
|
||
basic | ||
itpk_robot | ||
itpk_robot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
茉莉机器人 | ||
======================================== | ||
|
||
======================================== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,128 +1,122 @@ | ||
# 陣列 | ||
# 阵列 | ||
|
||
陣列可以將數字、文字、列表或变量,按照順序組合起來,這些按序排列資料集合就稱作陣列,一個陣列可以再細分為多個元素,或是一個陣列內還包含其他陣列,在進行比較複雜的運算時,也會透過陣列的操作來實現。 | ||
阵列可以将数字、文字、列表或变量,按照顺序组合起来,这些按序排列资料集合就称作阵列,一个阵列可以再细分为多个元素,或是一个阵列内还包含其他阵列,在进行比较复杂的运算时,也会透过阵列的操作来实现。 | ||
|
||
## 陣列積木清單 | ||
## 阵列积木清单 | ||
|
||
陣列積木包含建立陣列、建立空陣列、使用文字建立陣列、陣列取值、陣列編輯...等常用功能。 | ||
阵列积木包含建立阵列、建立空阵列、使用文字建立阵列、阵列取值、阵列编辑...等常用功能。 | ||
|
||
![陣列](../images/zh-tw/docs/webbit/basic/array-01.jpg) | ||
![阵列](../images/zh-tw/docs/webbit/basic/array-01.jpg) | ||
|
||
## 空陣列 | ||
## 空阵列 | ||
|
||
「空陣列」積木會建立一個陣列容器,也就是裡面沒有包含任何元素的陣列 | ||
「空阵列」积木会建立一个阵列容器,也就是里面没有包含任何元素的阵列 | ||
|
||
![陣列](../images/zh-tw/docs/webbit/basic/array-02.jpg) | ||
![阵列](../images/zh-tw/docs/webbit/basic/array-02.jpg) | ||
|
||
如果要用变量進行陣列的操作,首先必須把這個变量定義為陣列或空陣列,才能針對這個变量進行陣列數值的添加、刪除、編輯...等動作。 | ||
如果要用变量进行阵列的操作,首先必须把这个变量定义为阵列或空阵列,才能针对这个变量进行阵列数值的添加、删除、编辑...等动作。 | ||
|
||
![陣列](../images/zh-tw/docs/webbit/basic/array-03.jpg) | ||
![阵列](../images/zh-tw/docs/webbit/basic/array-03.jpg) | ||
|
||
## 建立陣列 | ||
## 建立阵列 | ||
|
||
「建立陣列」積木可以透過指定位置放入對應的內容,建立一個帶有數值的陣列。 | ||
「建立阵列」积木可以透过指定位置放入对应的内容,建立一个带有数值的阵列。 | ||
|
||
![陣列](../images/zh-tw/docs/webbit/basic/array-04.jpg) | ||
![阵列](../images/zh-tw/docs/webbit/basic/array-04.jpg) | ||
|
||
點擊藍色小齒輪,可以增加放入內容的缺口。 | ||
点击蓝色小齿轮,可以增加放入内容的缺口。 | ||
|
||
![陣列](../images/zh-tw/docs/webbit/basic/array-05.gif) | ||
![阵列](../images/zh-tw/docs/webbit/basic/array-05.gif) | ||
|
||
建立陣列完成後,可以透過小怪獸講出陣列 ( 陣列內容會用逗號分隔 )。 | ||
建立阵列完成后,可以透过小怪兽讲出阵列 ( 阵列内容会用逗号分隔 )。 | ||
|
||
![陣列](../images/zh-tw/docs/webbit/basic/array-06.jpg) | ||
![阵列](../images/zh-tw/docs/webbit/basic/array-06.jpg) | ||
|
||
或是也可以透過重複迴圈,依序講出陣列內容。 | ||
或是也可以透过重复回圈,依序讲出阵列内容。 | ||
|
||
![陣列](../images/zh-tw/docs/webbit/basic/array-07.gif) | ||
![阵列](../images/zh-tw/docs/webbit/basic/array-07.gif) | ||
|
||
|
||
## 建立重複內容陣列 | ||
## 建立重复内容阵列 | ||
|
||
「建立重複內容陣列」積木可以建立具有重複數值重複的列表,數值可以变量、文字、數字或陣列陣列,將熟放入缺口內,就會根據重複設定的次數建立陣列。 | ||
「建立重复内容阵列」积木可以建立具有重复数值重复的列表,数值可以变量、文字、数字或阵列阵列,将熟放入缺口内,就会根据重复设定的次数建立阵列。 | ||
|
||
![陣列](../images/zh-tw/docs/webbit/basic/array-08.jpg) | ||
![阵列](../images/zh-tw/docs/webbit/basic/array-08.jpg) | ||
|
||
舉例來說讓「芭樂」文字重複五次並建立陣列,綠色小怪獸就會唸出五個芭樂的文字。 | ||
举例来说让「芭乐」文字重复五次并建立阵列,绿色小怪兽就会念出五个芭乐的文字。 | ||
|
||
![陣列](../images/zh-tw/docs/webbit/basic/array-09.jpg) | ||
![阵列](../images/zh-tw/docs/webbit/basic/array-09.jpg) | ||
|
||
## 設定陣列內容 | ||
## 设定阵列内容 | ||
|
||
「設定陣列內容」積木可以針對陣列的內容 ( 第幾個、倒數第幾個、第一個、最後一個和隨機 ) 進行三種編輯行為 ( 設定、插入或移除 )。 | ||
「设定阵列内容」积木可以针对阵列的内容 ( 第几个、倒数第几个、第一个、最后一个和随机 ) 进行三种编辑行为 ( 设定、插入或移除 )。 | ||
|
||
![陣列](../images/zh-tw/docs/webbit/basic/array-10.jpg) | ||
![阵列](../images/zh-tw/docs/webbit/basic/array-10.jpg) | ||
|
||
舉例來說,原本的陣列有四種水果蘋果、柳丁、香蕉和芭樂,透過「設定陣列內容」積木將陣列中第一個水果元素換成蓮霧,綠色小怪獸講出的陣列第一個元素就變成了蓮霧,接著隨機移除陣列的一個內容,紅色小怪獸講出的陣列就會變成只有三種水果。 | ||
举例来说,原本的阵列有四种水果苹果、柳丁、香蕉和芭乐,透过「设定阵列内容」积木将阵列中第一个水果元素换成莲雾,绿色小怪兽讲出的阵列第一个元素就变成了莲雾,接着随机移除阵列的一个内容,红色小怪兽讲出的阵列就会变成只有三种水果。 | ||
|
||
![陣列](../images/zh-tw/docs/webbit/basic/array-11.jpg) | ||
![阵列](../images/zh-tw/docs/webbit/basic/array-11.jpg) | ||
|
||
如果接著使用「插入」桃子元素在「最後一個項目」,就可以看到陣列又變成四種水果,最後一種是桃子。 | ||
如果接着使用「插入」桃子元素在「最后一个项目」,就可以看到阵列又变成四种水果,最后一种是桃子。 | ||
|
||
![陣列](../images/zh-tw/docs/webbit/basic/array-12.jpg) | ||
![阵列](../images/zh-tw/docs/webbit/basic/array-12.jpg) | ||
|
||
## 取得陣列內容 | ||
## 取得阵列内容 | ||
|
||
「取得陣列內容」積木可以取得一個陣列中某個元素的值 ( 第幾個、倒數第幾個、第一個、最後一個和隨機 ),或是取得某個元素的值之後,同時移除該元素 。 | ||
「取得阵列内容」积木可以取得一个阵列中某个元素的值( 第几个、倒数第几个、第一个、最后一个和随机),或是取得某个元素的值之后,同时移除该元素。 | ||
|
||
![陣列](../images/zh-tw/docs/webbit/basic/array-13.jpg) | ||
![阵列](../images/zh-tw/docs/webbit/basic/array-13.jpg) | ||
|
||
如果單純取得某個元素的值,並不會影響原本陣列的內容和長度,但如果是「取得後移除」,這個陣列就不再包含這個元素,例如一開始有四種水果,如果只是取得內容,取得內容後的陣列依然是四種水果,不過如果取得後移除內容,取得內容之後陣列就變成了只有三種水果。 | ||
如果单纯取得某个元素的值,并不会影响原本阵列的内容和长度,但如果是「取得后移除」,这个阵列就不再包含这个元素,例如一开始有四种水果,如果只是取得内容,取得内容后的阵列依然是四种水果,不过如果取得后移除内容,取得内容之后阵列就变成了只有三种水果。 | ||
|
||
![陣列](../images/zh-tw/docs/webbit/basic/array-14.jpg) | ||
![阵列](../images/zh-tw/docs/webbit/basic/array-14.jpg) | ||
|
||
## 尋找陣列內容 | ||
## 寻找阵列内容 | ||
|
||
「取得陣列內容」積木能從一個陣列中,找到特定元素所在的位置,並回傳該位置的號碼。 | ||
「取得阵列内容」积木能从一个阵列中,找到特定元素所在的位置,并回传该位置的号码。 | ||
|
||
![陣列](../images/zh-tw/docs/webbit/basic/array-15.jpg) | ||
![阵列](../images/zh-tw/docs/webbit/basic/array-15.jpg) | ||
|
||
透過取得陣列積木來取得水果陣列,就能知道蘋果位在第一個位置、柳丁位在第二個位置、香蕉位在第三個位置、芭樂位在第四個位置。 | ||
透过取得阵列积木来取得水果阵列,就能知道苹果位在第一个位置、柳丁位在第二个位置、香蕉位在第三个位置、芭乐位在第四个位置。 | ||
|
||
> 注意,如果是「寫程序碼」而非使用「積木」,第一個位置通常都是 0,第二個位置是 1,因為和生活習慣一至,在程序積木裡頭第一個位置的顯示為 1,第二個位置為 2,依此類推。 | ||
> 注意,如果是「写程序码」而非使用「积木」,第一个位置通常都是0,第二个位置是1,因为和生活习惯一至,在程序积木里头第一个位置的显示为1,第二个位置为2,依此类推。 | ||
![陣列](../images/zh-tw/docs/webbit/basic/array-16.jpg) | ||
![阵列](../images/zh-tw/docs/webbit/basic/array-16.jpg) | ||
|
||
## 陣列排序 | ||
## 阵列排序 | ||
|
||
「陣列排序」積木會將指定的陣列做字母、數字的排序,排序後會形成一個新的陣列,*不會影響原本陣列的排序*。 | ||
「阵列排序」积木会将指定的阵列做字母、数字的排序,排序后会形成一个新的阵列,*不会影响原本阵列的排序*。 | ||
|
||
![陣列](../images/zh-tw/docs/webbit/basic/array-17.jpg) | ||
![阵列](../images/zh-tw/docs/webbit/basic/array-17.jpg) | ||
|
||
從下圖的例子可以看出,綠色小怪獸會講出按照字母排序過後的水果陣列 ( a,b,c,.... ),而紅色小怪獸講出原本的水果陣列並沒有受到排序積木的影響。 | ||
从下图的例子可以看出,绿色小怪兽会讲出按照字母排序过后的水果阵列( a,b,c,.... ),而红色小怪兽讲出原本的水果阵列并没有受到排序积木的影响。 | ||
|
||
![陣列](../images/zh-tw/docs/webbit/basic/array-18.jpg) | ||
![阵列](../images/zh-tw/docs/webbit/basic/array-18.jpg) | ||
|
||
如果選擇字母排序,就會「*先按照字母大小寫排序,大寫在前,小寫在後,排序後再按照第二個字母排序*」,如果選擇不區分大小寫,就會直接進行排序,「*如果第一個字母相同,就用第二個字母排序*」,以下圖的例子,大寫 A 在前小寫 a 在後,排序後再按照 123、456 進行排序。 | ||
如果选择字母排序,就会「*先按照字母大小写排序,大写在前,小写在后,排序后再按照第二个字母排序*」,如果选择不区分大小写,就会直接进行排序,「 *如果第一个字母相同,就用第二个字母排序*」,以下图的例子,大写A 在前小写a 在后,排序后再按照123、456 进行排序。 | ||
|
||
![陣列](../images/zh-tw/docs/webbit/basic/array-19.jpg) | ||
![阵列](../images/zh-tw/docs/webbit/basic/array-19.jpg) | ||
|
||
## 文字與陣列轉換 | ||
## 文字与阵列转换 | ||
|
||
「文字與陣列轉換」積木可以將帶有「分隔符」( 類似空白、逗號、分號...等分隔符號 ) 的文字轉換為陣列,或是將陣列合併為一串文字。 | ||
「文字与阵列转换」积木可以将带有「分隔符」( 类似空白、逗号、分号...等分隔符号 ) 的文字转换为阵列,或是将阵列合并为一串文字。 | ||
|
||
![陣列](../images/zh-tw/docs/webbit/basic/array-20.jpg) | ||
![阵列](../images/zh-tw/docs/webbit/basic/array-20.jpg) | ||
|
||
如果一串文字沒有變成陣列,其中第二個元素就會是第二個字 ( 綠色小怪獸就會講出「果」 ),如果將文字拆分為陣列,第二個元素就會是陣列中的第二個內容 ( 紅色小怪獸就會講出「柳丁」 )。 | ||
如果一串文字没有变成阵列,其中第二个元素就会是第二个字( 绿色小怪兽就会讲出「果」 ),如果将文字拆分为阵列,第二个元素就会是阵列中的第二个内容( 红色小怪兽就会讲出「柳丁」 )。 | ||
|
||
![陣列](../images/zh-tw/docs/webbit/basic/array-21.jpg) | ||
![阵列](../images/zh-tw/docs/webbit/basic/array-21.jpg) | ||
|
||
反之如果是將陣列合併為文字,可以將分隔符留空,就會看見陣列的內容變成一整串的文字,中間不會有逗號分隔,如果帶有分隔符 ( 例如 a ),就會看見結合成的文字中間都有 a。 | ||
|
||
![陣列](../images/zh-tw/docs/webbit/basic/array-22.jpg) | ||
|
||
## 陣列長度 | ||
|
||
「陣列長度」積木可以取得個陣列的元素總數,如果是空陣列則陣列長度為 0。 | ||
|
||
![陣列](../images/zh-tw/docs/webbit/basic/array-23.jpg) | ||
|
||
因為陣列長度表示的是「陣列的空格數」( 陣列可以放入多少個元素 ),所以如果「有空格」但沒有放入元素,仍然會影響陣列長度,例如有個四格空格的陣列,但只放入了三種水果,最後呈現出來的陣列長度就是 3。 | ||
|
||
![陣列](../images/zh-tw/docs/webbit/basic/array-24.jpg) | ||
反之如果是将阵列合并为文字,可以将分隔符留空,就会看见阵列的内容变成一整串的文字,中间不会有逗号分隔,如果带有分隔符( 例如a ),就会看见结合成的文字中间都有a。 | ||
|
||
![阵列](../images/zh-tw/docs/webbit/basic/array-22.jpg) | ||
|
||
## 阵列长度 | ||
|
||
「阵列长度」积木可以取得个阵列的元素总数,如果是空阵列则阵列长度为 0。 | ||
|
||
![阵列](../images/zh-tw/docs/webbit/basic/array-23.jpg) | ||
|
||
因为阵列长度表示的是「阵列的空格数」( 阵列可以放入多少个元素),所以如果「有空格」但没有放入元素,仍然会影响阵列长度,例如有个四格空格的阵列,但只放入了三种水果,最后呈现出来的阵列长度就是3。 | ||
|
||
![阵列](../images/zh-tw/docs/webbit/basic/array-24.jpg) |
Oops, something went wrong.