I'm trying to write a function that allows reading a file, and if the file we want them to read doesn't exist, I want other functions and other code writing in the code to stop.
def readfile():
ok = False
while not ok:
try:
fnR = input()
f = open(fnR,"r")
readcontent = f.read()
ok = True
except:
print("file not found")
slc = int(input("to exit type '0' \n to try again type '1' "))
if slc == 0:
break
elif slc == 1:
ok = False
readfile()
x = 15+10
print(x)
i dont want to print x or calculate x i want to stop the entire code below the "readfile()" functions