Discuss Scratch

AlfabetonsOfficial
Scratcher
100+ posts

"is exactly equal to" block.

Note: This is different from the equals block. The equals block returns true if there is a capital A and a lowercase a and also returns true for:
<[01]=[1]>
<[1e3]=[1000]>
<[2.0]=[2]>
<[1 ] = [1]>

<[a ]=[a]> // returns false though for some reason.
I would like to suggest this block:
<[] exactly = [] :: operators>
It would return true ONLY if the strings are the exact same, no leading zeros in numbers, no E notation, even case sensitivity.
<[A] exactly = [a] :: operators>
<[01] exactly = [1] :: operators>
<[2.0] exactly = [2] :: operators>
<[1e3] exactly = [1000] :: operators>
<[1 ] exactly = [1] :: operators>
would all return false, but
<[1] exactly = [1] :: operators>
would return true because there is no modification between the two strings. This would be helpful for quizzes, prompts, etc.
TheClaw7654
Scratcher
500+ posts

"is exactly equal to" block.

support, useful if you want to put secret codes in your games with exact cAPitaLiZmS

Last edited by TheClaw7654 (June 6, 2021 15:02:01)

mumu245
Scratcher
1000+ posts

"is exactly equal to" block.

Support!
fdreerf
Scratcher
1000+ posts

"is exactly equal to" block.

I think the block should use the “exactly equal to” symbol, ≡, since it's much shorter.
<[] ≡ [] ::operators>
DarthVader4Life
Scratcher
1000+ posts

"is exactly equal to" block.

mumu245 wrote:

Support!
[j] Why?! Just tell us why! AHHHHHHHHHHH [/j]
Seriously, Why? You have to state why otherwise it's spam.
badilreal
Scratcher
100+ posts

"is exactly equal to" block.

TheClaw7654 wrote:

support, useful if you want to put secret codes in your games with exact cAPitaLiZmS
do u mean case sensitive
CITHCrate
Scratcher
57 posts

"is exactly equal to" block.

i think it would look better as this
<[] == [] :: operators>
mmnagelia
Scratcher
100+ posts

"is exactly equal to" block.

fdreerf wrote:

I think the block should use the “exactly equal to” symbol, ≡, since it's much shorter.
<[] ≡ [] ::operators>
I agree. Its shorter and more recognizable.
Anyways, I support since it would be helpful for codes.

CITHCrate wrote:

i think it would look better as this
<[] == [] :: operators>
I don't like that, since in many programming languages, that means the same as
<[] = []>
block. @fdreerf is better imo.
Sheep_maker
Scratcher
1000+ posts

"is exactly equal to" block.

fdreerf wrote:

I think the block should use the “exactly equal to” symbol, ≡, since it's much shorter.
<[] ≡ [] ::operators>
Hmm, Scratch block names in English typically only use characters found on the US keyboard. Also, I feel like when scanning code, the difference between ≡ and = might be small and hard to notice. New Scratchers probably won't be familiar with the ≡ symbol, though I suppose the same could be argued for * or / or mod. I usually don't come across the ≡ symbol as often though

I feel like a longer name (or perhaps default values are enough) is more descriptive of how the block differs from the _ = _ block
<[apple] matches [Apple] exactly?::operators>

How would this block deal with values of different types? For example, would these report true or false? (the _ = _ block reports true for all of these)
<(() + (1)) exactly = [1.0]::operators>
<(() + ()) exactly = [0e123456]::operators>
<<not <>> exactly = (join [true] [])::operators>
<<not <>> exactly = (join [1] [])::operators>
Westech60
Scratcher
84 posts

"is exactly equal to" block.

Support. This probably could be used in many ways
Maximouse
Scratcher
1000+ posts

"is exactly equal to" block.

Sheep_maker wrote:

How would this block deal with values of different types? For example, would these report true or false? (the _ = _ block reports true for all of these)
<(() + (1)) exactly = [1.0]::operators>
<(() + ()) exactly = [0e123456]::operators>
<<not <>> exactly = (join [true] [])::operators>
<<not <>> exactly = (join [1] [])::operators>
A similar block in Snap! reports true when comparing different types of numbers and false when comparing Booleans with strings:

But because the suggestion mentions leading zeroes and scientific notations, I think the suggested block should report false in all four cases.
AlfabetonsOfficial
Scratcher
100+ posts

"is exactly equal to" block.

Sheep_maker wrote:

fdreerf wrote:

I think the block should use the “exactly equal to” symbol, ≡, since it's much shorter.
<[] ≡ [] ::operators>
Hmm, Scratch block names in English typically only use characters found on the US keyboard. Also, I feel like when scanning code, the difference between ≡ and = might be small and hard to notice. New Scratchers probably won't be familiar with the ≡ symbol, though I suppose the same could be argued for * or / or mod. I usually don't come across the ≡ symbol as often though

I feel like a longer name (or perhaps default values are enough) is more descriptive of how the block differs from the _ = _ block
<[apple] matches [Apple] exactly?::operators>

How would this block deal with values of different types? For example, would these report true or false? (the _ = _ block reports true for all of these)
<(() + (1)) exactly = [1.0]::operators>
<(() + ()) exactly = [0e123456]::operators>
<<not <>> exactly = (join [true] [])::operators>
<<not <>> exactly = (join [1] [])::operators>
1. False, because 1.0 has a “.0” at the end and 1 doesn't.
2. False, because 0e123456 has an “e123456” at the end.
3. True.
4. False, because booleans either report “true” or “false”, not numbers.
gosoccerboy5
Scratcher
1000+ posts

"is exactly equal to" block.

fdreerf wrote:

I think the block should use the “exactly equal to” symbol, ≡, since it's much shorter.
<[] ≡ [] ::operators>
It is admittedly shorter, but it may be harder to read quickly, and would probably be confusing to new scratchers or even anyone else. “Exactly equals” gets the idea across perfectly. (I can't believe I just said “confusing to new scratchers” >.<)

CITHCrate wrote:

i think it would look better as this
<[] == [] :: operators>
in my opinion that would be similarly confusing.

Last edited by gosoccerboy5 (June 7, 2021 20:39:01)

-Rex-
Scratcher
500+ posts

"is exactly equal to" block.

What about
[1] exactly = ((1) * (1)) :: boolean operators
and
[1] exactly = ((1.0) * (1.0)) :: boolean operators
Would the block return false in both cases?
((1) * (1)) exactly = ((1.0) * (1.0)) :: boolean operators
Does the block return true?

Last edited by -Rex- (June 7, 2021 23:40:52)

AlfabetonsOfficial
Scratcher
100+ posts

"is exactly equal to" block.

-Rex- wrote:

What about
[1] exactly = ((1) * (1)) :: boolean operators
and
[1] exactly = ((1.0) * (1.0)) :: boolean operators
Would the block return false in both cases?
((1) * (1)) exactly = ((1.0) * (1.0)) :: boolean operators
Does the block return true?
The booleans depend on what the reporter blocks REPORT, not its looks. So, all three of them will return true.
-Rex-
Scratcher
500+ posts

"is exactly equal to" block.

AlfabetonsOfficial wrote:

-Rex- wrote:

What about
[1] exactly = ((1) * (1)) :: boolean operators
and
[1] exactly = ((1.0) * (1.0)) :: boolean operators
Would the block return false in both cases?
((1) * (1)) exactly = ((1.0) * (1.0)) :: boolean operators
Does the block return true?
The booleans depend on what the reporter blocks REPORT, not its looks. So, all three of them will return true.
The first two compare a string to a number. Why would they return true? Also, 1 and 1.0 will evaluate to the same number because Scratch does not support integers.

Last edited by -Rex- (June 7, 2021 23:42:46)

han614698
Scratcher
1000+ posts

"is exactly equal to" block.

-Rex- wrote:

AlfabetonsOfficial wrote:

-Rex- wrote:

What about
[1] exactly = ((1) * (1)) :: boolean operators
and
[1] exactly = ((1.0) * (1.0)) :: boolean operators
Would the block return false in both cases?
((1) * (1)) exactly = ((1.0) * (1.0)) :: boolean operators
Does the block return true?
The booleans depend on what the reporter blocks REPORT, not its looks. So, all three of them will return true.
The first two compare a string to a number. Why would they return true? Also, 1 and 1.0 will evaluate to the same number because Scratch does not support integers.
Comparing a string to a number doesn’t matter in the case they both are “1”.

Powered by DjangoBB