@eh_asuna, please edit your post, select all code and click the </> button to apply so-called code tags and next save your post. It makes it easier to read, easier to copy and prevents the forum software from incorrect interpretation of the code.
Please explain. And without context (the complete program) we have no idea what can be wrong.