Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

True and False blocks #2726

Open
Samq64 opened this issue Dec 23, 2021 · 3 comments
Open

True and False blocks #2726

Samq64 opened this issue Dec 23, 2021 · 3 comments
Labels

Comments

@Samq64
Copy link

Samq64 commented Dec 23, 2021

Simple true and false blocks have been suggested multiple times in the Scratch forums, so I thought I would bring it up here. Of course this is already possible by using the words true and false, but it's easier to just drag a block without typing anything. I've also seen some Scratchers use things like not<> or not<not<>> for Boolean values because it was faster than typing the word true or comparing 1 to 1 which makes the code very hard for other Scratchers to understand. If these two blocks get implemented, it would also make since to allow reporters in Boolean slots, so a variable that's set to true with the true and false blocks don't need to be compared to anything.

@ShipmasterKyle
Copy link

Sounds cool. What section would it go in?

@towerofnix
Copy link
Contributor

I'm not sure it would be right to just let any reporter go inside a boolean input slot (since many reporters have access to user data and thus can return "true" or "false" values)—but maybe a new block, "(value) is true?" could be added. This would take any block and then check if the value is true.

The reason I suggest this is because almost all boolean reporters follow a very specific phrasing along the lines of "object is condition?" - "mouse down?", "key pressed?", and "apple contains a?" for example. But user-created variables aren't necessarily going to look like this - not to mention the translation barrier of someone who speaks a different language looking at your code, seeing a variable in an "if" block, and having no idea what that means. The phrasing "if ((variable or reporter) is true?)" is clear and can be localized.

(It could probably have a dropdown so you can choose between "true" and "false" for convenience's sake - instead of "not (value) is true?" - and possibly be expanded to have other useful and otherwise unfilled programming conditions too, like "(value) is ALL-CAPS?", "lowercase?", "mixed case?".)

@tonygermano
Copy link

I'm new to Scratch, and I was looking for this feature. I defined a block that took a boolean input, but then I couldn't figure out how to use the block with an explicit true or false value. I ended up using <1 = 1> or <1 = 0>, but that seemed really clunky. It would make sense to me to put them in the Operators section since that's where you end up going to create most boolean expressions.

I also found it odd that I could add a boolean input to a defined block (which I could then use in a manner similar to a variable,) but I couldn't declare a variable with a boolean type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants