130 likes | 197 Views
PEMROGRAMAN TERSUTRKTUR. By: Siti Mariyah. MEMORY VARIABLES. firstName = “Tom” create a cchracter memory variable whose symbolic name shall be firstName and assign to the string “Tom” to that variable
E N D
PEMROGRAMAN TERSUTRKTUR By: SitiMariyah
MEMORY VARIABLES firstName = “Tom” create a cchracter memory variable whose symbolic name shall be firstName and assign to the string “Tom” to that variable lastName= “Jerry” create a cchracter memory variable whose symbolic name shall be lastNameand assign to the string “Jerry” to that variable Display memory display local variables, foxpro system variable, windows definition, menu definition and pop-up windows definition
MEMORY VARIABLES (2) ?firstName dipslay memory variable firstName ?lastName dipslay memory variable lastName ?”Hello” display character string-display Hello ?M.firstName display memory variable firstName ?M.lastName display memory variable lastName
MEMORY VARIABLES (3) noName = firstName create a carachtermemory variable whose symbolic name shall be noNameand assign the contents to the contents of variable firstName Key = 5 creates a numeric memory variable whose symbolic name shall be Key and assign 5 to that variable Key = 5.5 creates a numeric memory variable whose symbolic name shall be Key and assign 5.5 to that variable Valid = .T. create a logical memory varible whose symbolic name shall be Valid and assigns True to that variable Valid = NOT .F. create a logical memory varible whose symbolic name shall be Valid and assigns True to that variable myDay = {12/25/98} creates a logical memory variable whose symbolic name shall be myDay and assigns 12/25/98 to that variable
STRING FUNCTION AND MANIPULATION firstName = “tom” lastName = “jerry” noName = “john doe” The + symbol is used to concatenate (merge/combine) two or more strings ?”Hello” + firstName display Hello tom ? firstName + lastName display tomjerry ? firstName+’ ’+ lastName display tom jerry
STRING FUNCTION AND MANIPULATION (2) UPPER FUNCTION ? ‘[‘ + Upper(firstName) + ‘]’ display [TOM] ? ‘[‘ + Upper(“good TimE”) + ‘]’ display [GOOD TIME] totalName = firstName +’ ’+lastName create a local memory variable whose symbolic name shall be totalNameand assigns the contents to tom jerry totalName = Upper(lastName)+’, ’+Upper(firstName ) create a local memory variable whose symbolic name shall be totalName and assigns the contents to JERRY, TOM
STRING FUNCTION AND MANIPULATION (3) LOWER FUNCTION firstName = “TOm” lastName = “JERry” noName = “john doe” ? ‘[‘ + Lower(firstName) + ‘]’ display [tom] ? ‘[‘ + Lower(“good TimE”) + ‘]’ display [good time] totalName = firstName +’ ’+lastName create a local memory variable whose symbolic name shall be totalNameand assigns the contents to tom jerry totalName = Upper(lastName)+’, ’+Upper(firstName ) create a local memory variable whose symbolic name shall be totalName and assigns the contents to JERRY, TOM
OperasiTanggaldanWaktu CDOW() : menghasilkannamaharidalambahasainggris Logic : ?CDOW(ctod(“tanggal”)) Contoh : ?CDOW(ctod(“3/20/2006”)) Monday CMONTH() : menghasilkannamabulandalambahasainggris Logic : ?CMONTH(ctod(“tanggal”)) Contoh : ?CMONTH(ctod(“3/20/2006”)) March DATE() : menghasilkannilaitanggalsekarang Logic : ?DATE() Contoh : ?DATE() 04/09/2013
OperasiTanggaldanWaktu(2) DATETIME() : menghasilkannilaitanggalsekarang Logic : ?DATETIME() Contoh : ?DATETIME() 04/09/2013 05:30:21 PM DAY() : menghasilkantanggal (1 sd 30) Logic : ?DAY(“tanggal”) Contoh : ?DAY(ctod(“3/20/2006”)) 20 DMY() : menghasilkantanggal,bulan,dantahun Logic : ?DMY(ctod(“tanggal”)) Contoh : ?DMY(ctod(“3/20/2006”)) 20 March 2006
OperasiTanggaldanWaktu(3) MDY() : menghasilkanbulan, tanggal,dantahun Logic : ?DMY(ctod(“tanggal”)) Contoh : ?DMY(ctod(“3/20/2006”)) March 20, 2006 TIME() : menghasilkan jam sekarangdengan format hh:mm:ss Logic : ?TIME() Contoh : ?TIME() 05:30:21
Operasi Numeric ABS : menghasilkannilaimutlak Contoh : ?ABS(-3) 3 INT() : menghasilkanbilanganbulat Contoh : ?INT(1.9) 1
KonversiTipedanEkspresi ASC() : menghasilkannilai ASCII darikarakter yang menjadiargumen Contoh : ?ASC(“A”) 65 CHR() : menghasilkansebuahkarakter yang nilai ASCII nyadicantumkandalamargumen Contoh: ?CHR(65) A CTOD() : menghasilkan data bertipetanggalberdasarkan string argumennya Contoh: ?CTOD(“3/20/2006”) 03/20/2006Contoh
KonversiTipedanEkspresi (2) DTOC() : menghasilkan data bertipe string berdasarkan date argumennya Contoh: ?DTOC(date()) “03/20/2006” STR() : menghasilkannilai string dari numeric Contoh: ?STR(5) “5” VAL() : menghasilkannilai numeric dari string Contoh : ?VAL(“5“) 5