RosettaCodeData/Task/Search-a-list/BASIC256/search-a-list.basic
2023-07-01 13:44:08 -04:00

19 lines
427 B
Text

list$ = "mouse,hat,cup,deodorant,television,soap,methamphetamine,severed cat heads,cup"
n$ = explode(list$, ",")
t = 0 : j = 0
input string "Enter string to search: ", linea$
for i = 0 to n$[?]-1
if linea$ = n$[i] then
if not t then print "First index for "; linea$; ": "; i
t = i
j += 1
end if
next
if t = 0 then
print "String not found in list"
else
if j > 1 then print "Last index for "; linea$; ": "; t
end if