Printing First Element Array
Printing First Element Array
An array is a list of items that are text, numbers, booleans, or strings. Arrays
have a length which is the number of items they contain. Items in an array can
be identified by knowing their positions.
Arrays are flexible, they can grow and shrink in size. We can add, remove as
well as edit items at any place in the array.
Create the activity on Arcade using the MakeCode editor in the URL
https://arcade.makecode.com
Step 1: Create a
New Project by
clicking on ‘New
Project’. A
dialog box
‘Create your
project name’
appears.
Step 3: Click on
the “Arrays”
block type from
“Advanced” and
drag the “set
textlist to array”
block to
Workspace.
Click on “Text
list” drop down
and choose ‘New
variable’ and
name as ‘arr’.
Once created,
click on “text list’
drop down again
and choose ‘arr’
from the list.
Step 4: Click on
“+” in “set arr”
block and add “d”
“e”.
Note: “Splash”
block allows for a
message to pop
up on screen for
the user to read
on the simulator
window.
Step 5: Click on
“Advanced” and
“Text” from the
list. Drag “Join
‘Hello’ ‘World’
” block to the
workspace.
Step 6: In “Join
Hello World”
block replace
“Hello” with
“The first element
of the array is”
and “World” with
“ list get value at
0” from “Array”
block as shown.
Step 5: Click on
the “Functions”
block type from
“Advanced” and
drag “call Wish
‘abc’” block to
“on start” in the
workspace.
On start, the
program calls the
Function “Wish”
with a parameter
and splashes the
message.
Output: