Arrays “Array, I'm bound array, 'cross the wide Missouri.” ‒ Old Programmer’s Folk Song © Copyright 2014, Fred McClurg All Rights Reserved.

Slides:



Advertisements
Similar presentations
MAIN BODY OF PROGRAM DECLARATION ACTION
Advertisements

H γλώσσα CPN ML. 1. Δηλώσεις 3 Colour Sets Unit colset name = unit [with new_unit]; ex: colset U = unit;>>> 1`() colset E = unit with e;>>> 1`e.
Arrays. What is an array An array is used to store a collection of data It is a collection of variables of the same type.
Arrays  Writing a program that uses a large amount of information.  Such as a list of 100 elements.  It is not practical to declare.
COMP102 – Programming Fundamentals I LA2B (Mon 5-7pm) LA2E (Fri 3-5pm) LA2F (Fri 5-7pm) TA: Jackie Lo.
Arrays. Arrays  When a value is to be used in a program, a variable is declared to hold that value  What about storing the results of exams for a large.
/3024/ SUN MON TUE WED THU FRI SAT JANUARY 2011 February 2011 SMTWTFS
Arrays. Arrays  When a value is to be used in a program, a variable is declared to hold that value  What about storing the results of exams for a large.
The Data Element. 2 Data type: A description of the set of values and the basic set of operations that can be applied to values of the type. Strong typing:
JAVA Arrays. Objectives Be able to declare and initialize arrays Be able to conceptualize (draw) how arrays are represented in computer memory. Be able.
Array Methods © Copyright 2014, Fred McClurg All Rights Reserved.
Class 2Intro to Databases Goals of this class Include & Require in PHP Generating Random Numbers in PHP Arrays – Numerically Indexed and Associative Program.
Perl Chapter 5 Hashes. Outside of world of Perl, know as associative arrays Also called hash tables Perl one of few languages that has hashes built-in.
Other Variable Types Dim lab as String makes a box that can store a label tag Dim ColHead As String ColHead = “function” ColHead function Dim lab as Boolean.
Objects © Copyright 2014, Fred McClurg All Rights Reserved.
1 dimensional static Array Int[] a = new int[4]; A[0]A[1]A[2]A[3] Int[] b= new int[1]; B[0] Array is a list of variables having same name and same data.
Chapter 6. Character String Types It is one in which the values consists of sequences of characters. How to Define a variable contain a string? In a programming.
Comments Introduction to JavaScript © Copyright 2016, Fred McClurg All Rights Reserved.
Final Jeopardy Question POWER THEOREMS INSIDE THE CIRCLE 500 ON THE CIRCLE OUTSIDE THE CIRCLE CHAPTER 11 WITH A TWIST
© 2004 Pearson Addison-Wesley. All rights reserved October 5, 2007 Arrays ComS 207: Programming I (in Java) Iowa State University, FALL 2007 Instructor:
CSC 211 Java I for loops and arrays.
5 Day Forecast Mon Tues Wed Thu Fri.
Variable Scope Variable, variable, who’s got the variable?
© Copyright 2016, Fred McClurg All Rights Reserved
GANTT CHARTS Example Example Example Example text Tasks Example 1
Mon – 2Tue – 3Wed – 4Thu - 5Fri - 6Sat - 7Sun - 8 Mon – 9Tue – 10Wed – 11Thu - 12Fri – 13Sat – 14Sun -15 Mon – 16Tue – 17Wed – 18Thu - 19Fri – 20Sat –
JANUARY FEBRUARY MARCH APRIL MAY JUNE JULY AUGUST SEPTEMBER
JANUARY FEBRUARY MARCH APRIL MAY JUNE JULY AUGUST SEPTEMBER
MON TUE WED THU
JEOPARDY Review
1   1.テキストの入れ替え テキストを自由に入れ替えることができます。 フチなし全面印刷がおすすめです。 印刷のポイント.
JANUARY FEBRUARY MARCH APRIL MAY JUNE JULY AUGUST SEPTEMBER
January MON TUE WED THU FRI SAT SUN
January MON TUE WED THU FRI SAT SUN
2017 Jan Sun Mon Tue Wed Thu Fri Sat
ANNUAL CALENDAR HOLIDAYS JANUARY FEBRUARY MARCH APRIL MAY JUNE
HOLIDAYS ANNUAL CALENDAR JANUARY FEBRUARY MARCH APRIL MAY JUNE
January Sun Mon Tue Wed Thu Fri Sat
January MON TUE WED THU FRI SAT SUN
January MON TUE WED THU FRI SAT SUN
Jan Sun Mon Tue Wed Thu Fri Sat
HOLIDAYS ANNUAL CALENDAR JANUARY FEBRUARY MARCH APRIL MAY JUNE
2008 Calendar.
S M T W F S M T W F
January MON TUE WED THU FRI SAT SUN
Sun Mon Tue Wed Thu Fri Sat
1 - January - Sun Mon The Wed Thu Fri Sat
2 0 X X s c h e d u l e 1 MON TUE WED THU JANUARY 20XX FRI SAT SUN MEMO.
CS 240 – Lecture 7 Boolean Operations, Increment and Decrement Operators, Constant Types, enum Types, Precedence.
January MON TUE WED THU FRI SAT SUN
JANUARY 1 Sun Mon Tue Wed Thu Fri Sat
Calendar
Calendar – 2010 (October, November & December)
January MON TUE WED THU FRI SAT SUN
JANUARY 1 Sun Mon Tue Wed Thu Fri Sat
Sun Mon Tue Wed Thu Fri Sat
1/○~1/○ weekly schedule MON TUE WED THU FRI SAT SUN MEMO
January MON TUE WED THU FRI SAT SUN
S M T W F S M T W F
2016 | 10 OCT SUN MON TUE WED THU FRI SAT
Sun Mon Tue Wed Thu Fri Sat
JANUARY 1 Sun Mon Tue Wed Thu Fri Sat
WEB PAGES: Tables Welcome Back !.
June 2019 Seahawk Cross Country SUMMER RUNNING Sun Mon Tue Wed Thu Fri
1 January 2018 Sun Mon Tue Wed Thu Fri Sat
1 January MON TUE WED THU FRI SAT SUN MEMO 2 February MON TUE WED THU FRI SAT SUN.
2008 Calendar.
S M T W F S M T W F
S M T W F S M T W F
1 January MON TUE WED THU FRI SAT SUN MEMO 2 February MON TUE WED THU FRI SAT SUN.
Presentation transcript:

Arrays “Array, I'm bound array, 'cross the wide Missouri.” ‒ Old Programmer’s Folk Song © Copyright 2014, Fred McClurg All Rights Reserved

Array Declared What is an array? Set of values that are accessed by a variable name and a numeric index. Used to preserve a list order. Examples: // declare array var emptyArray = []; // square brackets // print array console.log( emptyArray ); 2 arrayDeclare.html

Element Initialization How do you initialize each element of an array? An array can be initialized element by element by referencing the index value. Examples: var dwarfs = []; // initialize empty array dwarfs[0] = "Doc"; dwarfs[1] = "Dopey"; dwarfs[2] = "Bashful"; dwarfs[3] = "Grumpy"; dwarfs[4] = "Sneezy"; dwarfs[5] = "Sleepy"; dwarfs[6] = "Happy"; dwarfs.length; // 7 dwarfs[ dwarfs.length - 1 ]; // "Happy" 3 elementInit.html

Array Initialization How do you initialize an entire array? All the elements in an array can be initialized in a single statement during declaration. Examples: // declare and initialize array var dow = [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ]; console.log( dow[0] ); // "Sun" console.log( dow.length ); // 7 4 arrayInit.html

Multiple Element Types What can you store in an array? An array can contain multiple data types. Examples: var mixedType = [ 1, 2, 3, // integers "a", "b", "c", // strings true, false // booleans ]; console.log( mixedType ); 5 multiElemTypes.html