I’m trying to find out prime numbers in my script, but when I call my function for that, I get a strange error: InvalidProgramException: Invalid IL code in RSA:isPrim (int): IL_0057: ldloc.0
Code:
def genPrim (start as int, max as int):
rdom as int
k = 2
while true:
rdom = Random.Range(start, max)
if self.isPrim(rdom):
break
return rdom
def isPrim (zahl as int):
finished as bool
if zahl <= 1:
finished = true
if not finished:
while k**2 <= zahl:
if zahl % k == 0:
finished = true
k += 1
return not finished
I checked everything and I just can’t find anything wrong ![]()