I'm trying to use functions more often and decided to try to make one so that if the word "stop" was found in any part of a users input, the program would end.
set display mode 1280,800,16
set text font "ariel"
set text size 22
do
cls
text 0,80,"User>>"
set cursor 70,80 : input user_input$
user_input$=lower$(user_input$)
if check("stop")=1 then end
loop
function check(word1$)
occurances=find sub string$(user_input$,word1$)
if occurances>0 then num=1
endfunction num
The idea was that the function would return a 1 if the word was found, but not only did thhat not happen, I got a message that said "DarkBASIC Pro Project has stopped working" and my program was forced to exit. Any help with this?
Do we all have to put stupid jokes here?