# Bug(?) with numbers, input, and strings

So I am making something and it needs you to set a 4-digit password using numbers. Because I am lazy, I chose to just use the set input block. I made all the code that makes it work, but you cannot put a 0 in the beginning. I am assuming this is because if you set it to 0926 (random number with a zero), it will automatically set it to 926. Anyways, this is frustrating and if any of you know a way to make it work, please tell me! If there is no way to do that, then I will just put in the prompt to not start the password with a zero.

Here is the code:

Code

8 Likes

It doesâ€™t work like that unfortunately

With Hopscotch anyways

5 Likes

Aw that is too bad. I guess I will just keep it as it is.

4 Likes

I mean, I could add 10^length(password) and just do it like that

4 Likes

That didnâ€™t work never mind

4 Likes

I can make a demo for you later when I get the time.

3 Likes

Any 0â€™s before the actual number (anything greater than 0) will be removed automatically. There is an easy fix. You just need to use multiple variables to save each number and check if each one is equal to their correct counterpartsâ€¦

2 Likes

Here is a project I made over 133 weeks ago: https://c.gethopscotch.com/p/z9pomd9by

This is a perfect example of how you can get it to work. Using a keyboard input wonâ€™t necessarily work because the length will be set to what the numberâ€™s length is after the 0â€™sâ€¦

You could try to put a random symbol before the number so it makes it keep the zerosâ€¦

3 Likes

Ok, strike that last part, it doesnâ€™t workâ€¦

4 Likes

Wow thanks! I will try that

2 Likes

Ok, but any method to try to force a zero before the number will not work.

3 Likes
3 Likes

You could try and create a Hopscotch version of an onscreen keyboard, but that will probably be boringâ€¦

And, if the first char is inputted, a random symbol will be forced, but wonâ€™t alter the codeâ€¦

2 Likes

Maybeâ€¦

2 Likes

But only if you force it yourselfâ€¦

3 Likes

Whatâ€¦

3 Likes

Thatâ€™s what my mind says time to timeâ€¦

3 Likes

Whatâ€¦

2 Likes

But I am using the length variable so yeah I donâ€™t know if it would work

1 Like

It doesnâ€™t. The length is automatically set right after you hit â€śOKâ€ť.

2 Likes