0

This is my code

INPUT "what year right now : ", thn1
CLS
thn2 = thn1
num = 0
PRINT "No      Jenis Kelamin     Tanggal Lahir     NPM         Nama"
10 READ jk$, tgl$, thl, npm$, nma$
IF jk$ = "0" THEN END
thn1 = thn2
thn1 = thn1 - thl
IF jk$ = "L" OR thn1 < 18 THEN GOTO 10
num = num + 1
PRINT num, jk$, tgl$, npm$, nma$
GOTO 10
DATA "L","11-03-2000",2000,"52418436","Fajar","P","20-06-1999",1999,"89436754","Rida","P","17-01-2002",2001,"37904638","Selly","L","09-08-1998",1998,"47382901","Fadli","P","28-04-2000",2000,"37464903","Bella","0","0","0","0","0","0"

the output is just as i wanted but there is popup alert :

Unhandled Error #2

Line 6(in main module) Syntax error continue?

Yes No

How to fix this?

1 Answers1

1

My guess is that you are attempting to read "0" (type STRING) into variable thl (default type is SINGLE) when the last READ occurs (you also need to remove the last "0"). Change

"Bella","0","0","0","0","0","0"

to

"Bella","0","0",0,"0","0"

You can also use multiple DATA statements to keep things organized. Here is how I might write the code, assuming memory is not an issue:

DATA "L","11-03-2000",2000,"52418436","Fajar"
DATA "P","20-06-1999",1999,"89436754","Rida"
DATA "P","17-01-2002",2001,"37904638","Selly"
DATA "L","09-08-1998",1998,"47382901","Fadli"
DATA "P","28-04-2000",2000,"37464903","Bella"
DATA "0","00-00-0000",0000,"00000000","00000"