SlideShare a Scribd company logo
1 of 29
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.

More Related Content

What's hot

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
 

What's hot (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
 

Viewers also liked

Viewers also liked (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 to Pemrograman Terstruktur 4

Similar to 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
 
Homework Assignment – Array Technical DocumentWrite a technical .pdf
Homework Assignment – Array Technical DocumentWrite a technical .pdfHomework Assignment – Array Technical DocumentWrite a technical .pdf
Homework Assignment – Array Technical DocumentWrite a technical .pdf
 
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
 

Recently uploaded

presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfOverkill Security
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 

Recently uploaded (20)

presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 

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.