SlideShare una empresa de Scribd logo
1 de 29
Descargar para leer sin conexión
ARRAY
BY : SITI MARIYAH, SST
ARRAY
Contoh array 1 dimensi:
kelasku(1,5) = {“1A”, “1B”, “1C”, “1D”, “1E”}
Data 5 kelas dimasukkan dalam satu array yang
bernama kelas.
Contoh array 2 dimensi :
kelasku(2, 3) = {(“1A”, “1B”, “1C”),(“1E”, “1F”,
“1G”)}
DIMENSION COMMAND
Logic :
DIMENSION ArrayName1(nRows1 [, nColumns1])
[AS Type] [, ArrayName2(nRows2 [,nColumns2])]
PARAMETER
1. ArrayName1  nama array
Kita bisa membuat multiple array dengan
satu dimensi hanya dengan menambahkan
nama array.
Contoh :
DIMENSION arrayName..,arrayName2…,arrayName3…
PARAMETER(2)
2. nRows1 [,nColumns1]  jumlah baris dan
kolom array
Contoh :
DIMENSION arraySatu(10)  array 1 dimensi dengan
10 baris dan 1 kolom
DIMENSION arraySatu(2,4)  array 2 dimensi
dengan 2 baris dan 4 kolom
DEKLARASI ARRAY
Contoh deklarasi :
DIMENSION arraySatu(10), arrayDua[2,4], arrayTiga(3,3)
DIMENSION arraySatu[10], arrayDua(2,4), arrayTiga[3,3]
Ukuran array tergantung pada banyaknya elemen yang
disimpan dalam array tersebut. Elemen array dapat
memiliki tipe data apa saja dan diinisialisasi False (.F.)
untuk pertama kali.
OPERASI ARRAY
STORE TO : Untuk menginisialisasi semua elemen
dengan nilai yang sama.
Contoh :
DIMENSION arraySatu(10,3)
STORE “initial” TO arraySatu
Logic di atas untuk menyimpan string initial ke
arraySatu. Sehingga initial menjadi elemen pertama
(baris1,kolom1) arraySatu
OPERASI ARRAY(2)
Array Subscript : digunakan untuk mengakses dan
manipulasi elemen array.
 Selain array subscript bisa juga menggunakan nama
array dan indeks.
 Pada array 1 dimensi, subscript digunakan untuk
mengidentifikasi nomor baris array. Contoh, subscript
untuk elemen yang berada di baris ketiga adalah 3
 Pada array 2 dimensi, subscript digunakan untuk
mengidentifikasi elemen array. Subscript yang pertama
menyatakan baris, subscript kedua menyatakan kolom
OPERASI ARRAY(3)
DIMENSION arrayName[5,2]
arrayName[1,2] = 966789
 Creates a one- or two-dimensional array.
 Visual FoxPro arrays are one-based
 DIMENSION is identical in operation and similar in
syntax to the DECLARE command
 Copies elements from one array to another array.
 Deletes an element from a one-dimensional array, or a
row or column from a two-dimensional array.
 Adds one record to the currently selected table for each
row in an array and fills each record with data from the
corresponding array row.
 Copies data from the currently selected table to an array.
 Executes the first set of commands whose conditional
expression evaluates to true (.T.).
Contoh
STORE CMONTH(DATE()) TO month
DO CASE
CASE INLIST(month, 'January', 'February', 'March')
STORE 'first quarter' TO rpt_title
CASE INLIST(month, „April', „May', „June')
STORE „second quarter' TO rpt_title
CASE INLIST(month, 'July', „August', „September')
STORE „third quarter' TO rpt_title
OTHERWISE
STORE „fourth quarter' TO rpt_title
ENDCASE
WAIT WINDOW rpt_title NOWAIT
 Executes a set of commands within a conditional loop.
 Exits a DO WHILE, FOR, SCAN, or
TRY…CATCH…FINALLY structure.
Contoh
CLOSE DATABASES OPEN DATABASE (HOME(2) + 'Datatestdata')
USE products && Opens Products table
SET TALK OFF
gnStockTot = 0
DO WHILE .T. && Begins loop
IF EOF( )
EXIT
ENDIF
IF unit_price < 20
SKIP LOOP
ENDIF
gnStockTot = gnStockTot + in_stock
SKIP
ENDDO && Ends loop
CLEAR
? 'Total items in stock valued over 20 dollars:'
?? gnStockTot
 Executes a set of commands for each element in a Visual
FoxPro array or collection.
Contoh
DIMENSION cMyArray(3)
cMyArray[1] = 'A'
cMyArray[2] = 'B'
cMyArray[3] = 'C'
FOR EACH cMyVar IN cMyArray
? cMyVar
ENDFOR
 Executes a set of commands a specified number of
times.
Contoh
FOR gnCount = 1 TO 10
? gnCount
ENDFOR
Contoh
OPEN DATABASE (HOME(2) + 'DataTestData')
USE Customer
FOR gnCount = 1 TO 10 STEP 2
GOTO gnCount
DISPLAY Company
ENDFOR
 Conditionally executes a set of commands based on the
value of a logical expression.
Contoh
USE Customer && Open customer table
GETEXPR „ Enter condition to locate ' TO gcTemp;
TYPE 'L' DEFAULT „ COMPANY = ""' LOCATE
FOR &gcTemp && Enter LOCATE expression
IF FOUND( ) && Was it found?
DISPLAY && If so, display the record
ELSE && If not found
? 'Condition ' + gcTemp + ' was not found '
&&Display a message
ENDIF
 Returns program control directly to the beginning of a
looping structure.
 Moves the record pointer through the currently selected
table and executes a block of commands for each record
that meets the specified conditions.

Más contenido relacionado

La actualidad más candente

The Ring programming language version 1.5.2 book - Part 22 of 181
The Ring programming language version 1.5.2 book - Part 22 of 181The Ring programming language version 1.5.2 book - Part 22 of 181
The Ring programming language version 1.5.2 book - Part 22 of 181Mahmoud Samir Fayed
 
The Ring programming language version 1.3 book - Part 13 of 88
The Ring programming language version 1.3 book - Part 13 of 88The Ring programming language version 1.3 book - Part 13 of 88
The Ring programming language version 1.3 book - Part 13 of 88Mahmoud Samir Fayed
 
5. R basics
5. R basics5. R basics
5. R basicsFAO
 
10. Getting Spatial
10. Getting Spatial10. Getting Spatial
10. Getting SpatialFAO
 
Data manipulation on r
Data manipulation on rData manipulation on r
Data manipulation on rAbhik Seal
 
R Programming: Numeric Functions In R
R Programming: Numeric Functions In RR Programming: Numeric Functions In R
R Programming: Numeric Functions In RRsquared Academy
 
The Ring programming language version 1.5.3 book - Part 23 of 184
The Ring programming language version 1.5.3 book - Part 23 of 184The Ring programming language version 1.5.3 book - Part 23 of 184
The Ring programming language version 1.5.3 book - Part 23 of 184Mahmoud Samir Fayed
 
Spark 4th Meetup Londond - Building a Product with Spark
Spark 4th Meetup Londond - Building a Product with SparkSpark 4th Meetup Londond - Building a Product with Spark
Spark 4th Meetup Londond - Building a Product with Sparksamthemonad
 
The Ring programming language version 1.2 book - Part 12 of 84
The Ring programming language version 1.2 book - Part 12 of 84The Ring programming language version 1.2 book - Part 12 of 84
The Ring programming language version 1.2 book - Part 12 of 84Mahmoud Samir Fayed
 
Data made out of functions
Data made out of functionsData made out of functions
Data made out of functionskenbot
 
The Ring programming language version 1.2 book - Part 10 of 84
The Ring programming language version 1.2 book - Part 10 of 84The Ring programming language version 1.2 book - Part 10 of 84
The Ring programming language version 1.2 book - Part 10 of 84Mahmoud Samir Fayed
 
The Ring programming language version 1.2 book - Part 11 of 84
The Ring programming language version 1.2 book - Part 11 of 84The Ring programming language version 1.2 book - Part 11 of 84
The Ring programming language version 1.2 book - Part 11 of 84Mahmoud Samir Fayed
 

La actualidad más candente (20)

The Ring programming language version 1.5.2 book - Part 22 of 181
The Ring programming language version 1.5.2 book - Part 22 of 181The Ring programming language version 1.5.2 book - Part 22 of 181
The Ring programming language version 1.5.2 book - Part 22 of 181
 
The Ring programming language version 1.3 book - Part 13 of 88
The Ring programming language version 1.3 book - Part 13 of 88The Ring programming language version 1.3 book - Part 13 of 88
The Ring programming language version 1.3 book - Part 13 of 88
 
5. R basics
5. R basics5. R basics
5. R basics
 
10. Getting Spatial
10. Getting Spatial10. Getting Spatial
10. Getting Spatial
 
Data manipulation on r
Data manipulation on rData manipulation on r
Data manipulation on r
 
R Programming: Numeric Functions In R
R Programming: Numeric Functions In RR Programming: Numeric Functions In R
R Programming: Numeric Functions In R
 
The Ring programming language version 1.5.3 book - Part 23 of 184
The Ring programming language version 1.5.3 book - Part 23 of 184The Ring programming language version 1.5.3 book - Part 23 of 184
The Ring programming language version 1.5.3 book - Part 23 of 184
 
Dplyr and Plyr
Dplyr and PlyrDplyr and Plyr
Dplyr and Plyr
 
Stack queue
Stack queueStack queue
Stack queue
 
Stack and queue
Stack and queueStack and queue
Stack and queue
 
Rsplit apply combine
Rsplit apply combineRsplit apply combine
Rsplit apply combine
 
Spark 4th Meetup Londond - Building a Product with Spark
Spark 4th Meetup Londond - Building a Product with SparkSpark 4th Meetup Londond - Building a Product with Spark
Spark 4th Meetup Londond - Building a Product with Spark
 
The Ring programming language version 1.2 book - Part 12 of 84
The Ring programming language version 1.2 book - Part 12 of 84The Ring programming language version 1.2 book - Part 12 of 84
The Ring programming language version 1.2 book - Part 12 of 84
 
Data made out of functions
Data made out of functionsData made out of functions
Data made out of functions
 
PAIP 第1章 Lisp入門
PAIP 第1章 Lisp入門PAIP 第1章 Lisp入門
PAIP 第1章 Lisp入門
 
CSE240 Doubly Linked Lists
CSE240 Doubly Linked ListsCSE240 Doubly Linked Lists
CSE240 Doubly Linked Lists
 
Data import-cheatsheet
Data import-cheatsheetData import-cheatsheet
Data import-cheatsheet
 
Stack, queue and hashing
Stack, queue and hashingStack, queue and hashing
Stack, queue and hashing
 
The Ring programming language version 1.2 book - Part 10 of 84
The Ring programming language version 1.2 book - Part 10 of 84The Ring programming language version 1.2 book - Part 10 of 84
The Ring programming language version 1.2 book - Part 10 of 84
 
The Ring programming language version 1.2 book - Part 11 of 84
The Ring programming language version 1.2 book - Part 11 of 84The Ring programming language version 1.2 book - Part 11 of 84
The Ring programming language version 1.2 book - Part 11 of 84
 

Destacado

Destacado (16)

SHS Library Annual Report 2011-2012
SHS Library Annual Report 2011-2012SHS Library Annual Report 2011-2012
SHS Library Annual Report 2011-2012
 
Kbsr
KbsrKbsr
Kbsr
 
Pemrograman Terstruktur 2
Pemrograman Terstruktur 2Pemrograman Terstruktur 2
Pemrograman Terstruktur 2
 
Bagaimana letak kod html
Bagaimana letak kod htmlBagaimana letak kod html
Bagaimana letak kod html
 
AFS Bay Area 2011-2012
AFS Bay Area 2011-2012AFS Bay Area 2011-2012
AFS Bay Area 2011-2012
 
Pemrograman Terstruktur 3
Pemrograman Terstruktur 3Pemrograman Terstruktur 3
Pemrograman Terstruktur 3
 
Pemrograman Terstruktur
Pemrograman TerstrukturPemrograman Terstruktur
Pemrograman Terstruktur
 
Trabajo BD
Trabajo BDTrabajo BD
Trabajo BD
 
Tutorial tukar template blog
Tutorial tukar template blogTutorial tukar template blog
Tutorial tukar template blog
 
CEST - Código Especificador da Substituição Tributária
CEST - Código Especificador da Substituição TributáriaCEST - Código Especificador da Substituição Tributária
CEST - Código Especificador da Substituição Tributária
 
LALUR: Revisando a parte A, entendendo a parte B
LALUR: Revisando a parte A, entendendo a parte BLALUR: Revisando a parte A, entendendo a parte B
LALUR: Revisando a parte A, entendendo a parte B
 
6th Arab Hr Conference
6th Arab Hr Conference6th Arab Hr Conference
6th Arab Hr Conference
 
Slideshow
SlideshowSlideshow
Slideshow
 
Materi Determinan (STIS)
Materi Determinan (STIS)Materi Determinan (STIS)
Materi Determinan (STIS)
 
Guia do Planejamento Tributário [e-book]
Guia do Planejamento Tributário [e-book]Guia do Planejamento Tributário [e-book]
Guia do Planejamento Tributário [e-book]
 
La crisi del'300
La crisi del'300La crisi del'300
La crisi del'300
 

Similar a Pemrograman Terstruktur 4

Similar a Pemrograman Terstruktur 4 (20)

Mysql
MysqlMysql
Mysql
 
2- Dimensional Arrays
2- Dimensional Arrays2- Dimensional Arrays
2- Dimensional Arrays
 
Fp201 unit4
Fp201 unit4Fp201 unit4
Fp201 unit4
 
ARRAYS
ARRAYSARRAYS
ARRAYS
 
Array 31.8.2020 updated
Array 31.8.2020 updatedArray 31.8.2020 updated
Array 31.8.2020 updated
 
Multi dimensional arrays
Multi dimensional arraysMulti dimensional arrays
Multi dimensional arrays
 
MA3696 Lecture 6
MA3696 Lecture 6MA3696 Lecture 6
MA3696 Lecture 6
 
Array
ArrayArray
Array
 
Arrays
ArraysArrays
Arrays
 
Data structure array
Data structure  arrayData structure  array
Data structure array
 
Chap1 array
Chap1 arrayChap1 array
Chap1 array
 
R programming
R programmingR programming
R programming
 
Chapter13 two-dimensional-array
Chapter13 two-dimensional-arrayChapter13 two-dimensional-array
Chapter13 two-dimensional-array
 
Array,MULTI ARRAY, IN C
Array,MULTI ARRAY, IN CArray,MULTI ARRAY, IN C
Array,MULTI ARRAY, IN C
 
Intro to C# - part 2.pptx emerging technology
Intro to C# - part 2.pptx emerging technologyIntro to C# - part 2.pptx emerging technology
Intro to C# - part 2.pptx emerging technology
 
02 arrays
02 arrays02 arrays
02 arrays
 
Arrays in VbScript
Arrays in VbScriptArrays in VbScript
Arrays in VbScript
 
Arrays
ArraysArrays
Arrays
 
Data Structure Midterm Lesson Arrays
Data Structure Midterm Lesson ArraysData Structure Midterm Lesson Arrays
Data Structure Midterm Lesson Arrays
 
Introduction to Arrays in C
Introduction to Arrays in CIntroduction to Arrays in C
Introduction to Arrays in C
 

Último

Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdfPedro Manuel
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfAijun Zhang
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXTarek Kalaji
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URLRuncy Oommen
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024SkyPlanner
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7DianaGray10
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfJamie (Taka) Wang
 
How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?IES VE
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAshyamraj55
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Commit University
 
Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Brian Pichman
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesDavid Newbury
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfDianaGray10
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024D Cloud Solutions
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsSafe Software
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfinfogdgmi
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxGDSC PJATK
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPathCommunity
 

Último (20)

Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdf
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdf
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBX
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URL
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
 
How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)
 
Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond Ontologies
 
201610817 - edge part1
201610817 - edge part1201610817 - edge part1
201610817 - edge part1
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdf
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptx
 
20150722 - AGV
20150722 - AGV20150722 - AGV
20150722 - AGV
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation Developers
 

Pemrograman Terstruktur 4

  • 1. ARRAY BY : SITI MARIYAH, SST
  • 2. ARRAY Contoh array 1 dimensi: kelasku(1,5) = {“1A”, “1B”, “1C”, “1D”, “1E”} Data 5 kelas dimasukkan dalam satu array yang bernama kelas. Contoh array 2 dimensi : kelasku(2, 3) = {(“1A”, “1B”, “1C”),(“1E”, “1F”, “1G”)}
  • 3. DIMENSION COMMAND Logic : DIMENSION ArrayName1(nRows1 [, nColumns1]) [AS Type] [, ArrayName2(nRows2 [,nColumns2])]
  • 4. PARAMETER 1. ArrayName1  nama array Kita bisa membuat multiple array dengan satu dimensi hanya dengan menambahkan nama array. Contoh : DIMENSION arrayName..,arrayName2…,arrayName3…
  • 5. PARAMETER(2) 2. nRows1 [,nColumns1]  jumlah baris dan kolom array Contoh : DIMENSION arraySatu(10)  array 1 dimensi dengan 10 baris dan 1 kolom DIMENSION arraySatu(2,4)  array 2 dimensi dengan 2 baris dan 4 kolom
  • 6. DEKLARASI ARRAY Contoh deklarasi : DIMENSION arraySatu(10), arrayDua[2,4], arrayTiga(3,3) DIMENSION arraySatu[10], arrayDua(2,4), arrayTiga[3,3] Ukuran array tergantung pada banyaknya elemen yang disimpan dalam array tersebut. Elemen array dapat memiliki tipe data apa saja dan diinisialisasi False (.F.) untuk pertama kali.
  • 7. OPERASI ARRAY STORE TO : Untuk menginisialisasi semua elemen dengan nilai yang sama. Contoh : DIMENSION arraySatu(10,3) STORE “initial” TO arraySatu Logic di atas untuk menyimpan string initial ke arraySatu. Sehingga initial menjadi elemen pertama (baris1,kolom1) arraySatu
  • 8. OPERASI ARRAY(2) Array Subscript : digunakan untuk mengakses dan manipulasi elemen array.  Selain array subscript bisa juga menggunakan nama array dan indeks.  Pada array 1 dimensi, subscript digunakan untuk mengidentifikasi nomor baris array. Contoh, subscript untuk elemen yang berada di baris ketiga adalah 3  Pada array 2 dimensi, subscript digunakan untuk mengidentifikasi elemen array. Subscript yang pertama menyatakan baris, subscript kedua menyatakan kolom
  • 10.  Creates a one- or two-dimensional array.  Visual FoxPro arrays are one-based
  • 11.  DIMENSION is identical in operation and similar in syntax to the DECLARE command
  • 12.  Copies elements from one array to another array.
  • 13.  Deletes an element from a one-dimensional array, or a row or column from a two-dimensional array.
  • 14.  Adds one record to the currently selected table for each row in an array and fills each record with data from the corresponding array row.
  • 15.  Copies data from the currently selected table to an array.
  • 16.  Executes the first set of commands whose conditional expression evaluates to true (.T.).
  • 17. Contoh STORE CMONTH(DATE()) TO month DO CASE CASE INLIST(month, 'January', 'February', 'March') STORE 'first quarter' TO rpt_title CASE INLIST(month, „April', „May', „June') STORE „second quarter' TO rpt_title CASE INLIST(month, 'July', „August', „September') STORE „third quarter' TO rpt_title OTHERWISE STORE „fourth quarter' TO rpt_title ENDCASE WAIT WINDOW rpt_title NOWAIT
  • 18.  Executes a set of commands within a conditional loop.
  • 19.  Exits a DO WHILE, FOR, SCAN, or TRY…CATCH…FINALLY structure.
  • 20. Contoh CLOSE DATABASES OPEN DATABASE (HOME(2) + 'Datatestdata') USE products && Opens Products table SET TALK OFF gnStockTot = 0 DO WHILE .T. && Begins loop IF EOF( ) EXIT ENDIF IF unit_price < 20 SKIP LOOP ENDIF gnStockTot = gnStockTot + in_stock SKIP ENDDO && Ends loop CLEAR ? 'Total items in stock valued over 20 dollars:' ?? gnStockTot
  • 21.  Executes a set of commands for each element in a Visual FoxPro array or collection.
  • 22. Contoh DIMENSION cMyArray(3) cMyArray[1] = 'A' cMyArray[2] = 'B' cMyArray[3] = 'C' FOR EACH cMyVar IN cMyArray ? cMyVar ENDFOR
  • 23.  Executes a set of commands a specified number of times.
  • 24. Contoh FOR gnCount = 1 TO 10 ? gnCount ENDFOR
  • 25. Contoh OPEN DATABASE (HOME(2) + 'DataTestData') USE Customer FOR gnCount = 1 TO 10 STEP 2 GOTO gnCount DISPLAY Company ENDFOR
  • 26.  Conditionally executes a set of commands based on the value of a logical expression.
  • 27. Contoh USE Customer && Open customer table GETEXPR „ Enter condition to locate ' TO gcTemp; TYPE 'L' DEFAULT „ COMPANY = ""' LOCATE FOR &gcTemp && Enter LOCATE expression IF FOUND( ) && Was it found? DISPLAY && If so, display the record ELSE && If not found ? 'Condition ' + gcTemp + ' was not found ' &&Display a message ENDIF
  • 28.  Returns program control directly to the beginning of a looping structure.
  • 29.  Moves the record pointer through the currently selected table and executes a block of commands for each record that meets the specified conditions.