0 votes

*a code that checks if the clock variable is actually a clock or something else

I am a beginner programmer and I know this hurts your eyes, please also tell me how can I achieve what I'm trying to achieve in a simpler way as well

if clock.length() == 5:

    for current in clock.length():

        match typeof(clock[current] as int):

            TYPE_STRING:

                if current == 3 and clock[current] == ":":

                    pass

                else:

                    print("wrong clock")
                    break



            TYPE_INT:

                pass


            _:

                print("wrong clock")
                break




    print("correct!")
in Engine by (20 points)

1 Answer

0 votes

What about if clock[3] == ":"?

by (7,190 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.