Discuss Scratch

medians
Scratcher
1000+ posts

Case Sensitivity Options

Bringing this topic up, though I feel like there could be a case sensitive block too, like this:

Last edited by medians (May 15, 2024 21:07:59)

banana439monkey
Scratcher
1000+ posts

Case Sensitivity Options

this is gonna be fun!
it's not just case sensitivity but types overall!
i know that scratch cares about types even less than negligent javascript but types would still be cool
so here's the thing:
console.log("1" == 1) // This returns true, they're the same value, regardless of their type
console.log("abc" == "ABC") // These are different, since different cases
console.log("abc" == "ABC".toLowerCase()) // This converts ABC to lowercase and hence returns true
console.log("1" === 1) // "1" and 1 are the same value but different types ("1" is a string, a piece of text, while 1 is a number, and so this returns false
// But now it becomes funky because...
console.log(true == 1) // This returns true...
// And fun fact
console.log({} == {}) // Returns false because referring to an object actually refers to its pointer in memory, rather than the object itself
so it all depends here, but it would be nice to also have:
<[1] strictly = [1] :: operators>
to strictly check for types too

wait but now we have all kinds of carnage because scratch is not set up for this…

Banana
eoeoeoeoeoeoeoeoe
Scratcher
100+ posts

Case Sensitivity Options

What is a good workaround for “item # of ()” block since it is not case-sensitive?
medians
Scratcher
1000+ posts

Case Sensitivity Options

eoeoeoeoeoeoeoeoe wrote:

What is a good workaround for “item # of ()” block since it is not case-sensitive?
If you mean the index block that was added in 3.0, you can do this for a workaround:
define item # of (string1) in list
set [result v] to [0] //keep track of the item in the list
if <[list v] contains (string1)> then
repeat until <(item (result) of [list v]) = (string1)>
change [result v] by (1)
end
end
The contains part is to make sure that the result var is 0
However, the contains list block is case insensitive in Scratch 2.0 and later, and the equals block is case insensitive too, so you can use something like this (the following works because of the fact that costumes are case sensitive):
https://scratch.mit.edu/projects/10213040/

Last edited by medians (July 1, 2024 02:01:19)

BigNate469
Scratcher
1000+ posts

Case Sensitivity Options

The only issue I see with this is that the settings icon on the block would be really hard for people on tablets to tap, due to its size. I think what @medians suggested, with a
set case sensitivity to [case sensitive v] :: operators stack
would work better. It would also allow you to change case-sensitivity modes programmatically.
eoeoeoeoeoeoeoeoe
Scratcher
100+ posts

Case Sensitivity Options

medians wrote:

eoeoeoeoeoeoeoeoe wrote:

What is a good workaround for “item # of ()” block since it is not case-sensitive?
If you mean the index block that was added in 3.0, you can do this for a workaround:
define item # of (string1) in list
set [result v] to [0] //keep track of the item in the list
if <[list v] contains (string1)> then
repeat until <(item (result) of [list v]) = (string1)>
change [result v] by (1)
end
end
The contains part is to make sure that the result var is 0
However, the contains list block is case insensitive in Scratch 2.0 and later, and the equals block is case insensitive too, so you can use something like this (the following works because of the fact that costumes are case sensitive):
https://scratch.mit.edu/projects/10213040/
Thanks for the advice, but I already implemented it as soon as I commented on this because of Scratch Wiki research. I have expanded case sensitive equality to whole words containing any character too to help me.
jmdzti_0-0
Scratcher
1000+ posts

Case Sensitivity Options

Last edited by jmdzti_0-0 (July 3, 2024 18:02:17)

medians
Scratcher
1000+ posts

Case Sensitivity Options

jmdzti_0-0 wrote:

This has already been suggested (Dupe)
You created that 4 years after this topic though
Edit: I meant to type 5

Last edited by medians (July 3, 2024 13:21:26)

Dragonmyflesh
Scratcher
500+ posts

Case Sensitivity Options

Scratch needs this, I support!
jmdzti_0-0
Scratcher
1000+ posts

Case Sensitivity Options

medians wrote:

jmdzti_0-0 wrote:

This has already been suggested (Dupe)
You created that 4 years after this topic though
Edit: I meant to type 5
Ah, why isn’t the op date in the post table ;-;
HighlaneGamingStudio
Scratcher
100+ posts

Case Sensitivity Options

I'm trying to make CVEDS (Cloud Variable Encoding/Decoding System) and I made the whole program, thinking that it was case-sensitive, only to find out that it wasn't. When I typed in Hello world! it gave me hHeElLoO wWoOrRlLdD! I think that
set case sensitivity to [case-sensitive v]::sensing
should be added, along with
turbo mode [on v]::control

Edit: The turbo mode block is off topic, discuss it here. Since I first made this post, I have made a version of CVEDS that is way more efficient than the one referenced here that uses the costume workaround. I also have different ideas about the case sensitivity block now, see below.

Last edited by HighlaneGamingStudio (Jan. 17, 2025 03:01:32)

medians
Scratcher
1000+ posts

Case Sensitivity Options

HighlaneGamingStudio wrote:

I'm trying to make CVEDS (Cloud Variable Encoding/Decoding System) and I made the whole program, thinking that it was case-sensitive, only to find out that it wasn't. When I typed in Hello world! it gave me hHeElLoO wWoOrRlLdD! I think that
set case sensitivity to [case-sensitive v]::sensing
should be added, along with
turbo mode [on v]::control
Separate suggestions should go in separate topics.
The first one was suggested earlier, while the other one has been suggested here:
https://scratch.mit.edu/discuss/post/933/
blubby4
Scratcher
100+ posts

Case Sensitivity Options

I suppose the minimum implementation for this suggestion would just be
<[] is capital? :: operators>
it would return true if every character is capital.
CaptainPeter
Scratcher
40 posts

Case Sensitivity Options

Maybe something like this?

Regular equals (true):

<[a] [= v] [A]>

Strict equals (false):

<[a] [== v] [A]>
endyourenite
Scratcher
100+ posts

Case Sensitivity Options

CaptainPeter wrote:

Strict equals (false):

<[a] [== v] [A]>
That's basically not equals, and we don't need it because we can do this:
<not <[] = []>>
HighlaneGamingStudio
Scratcher
100+ posts

Case Sensitivity Options

medians wrote:

Separate suggestions should go in separate topics.
The first one was suggested earlier, while the other one has been suggested here:
https://scratch.mit.edu/discuss/post/933/
Point taken.

Last edited by HighlaneGamingStudio (May 18, 2025 02:44:41)

HighlaneGamingStudio
Scratcher
100+ posts

Case Sensitivity Options

HighlaneGamingStudio wrote:

I'm trying to make CVEDS (Cloud Variable Encoding/Decoding System) and I made the whole program, thinking that it was case-sensitive, only to find out that it wasn't. When I typed in Hello world! it gave me hHeElLoO wWoOrRlLdD! I think that
set case sensitivity to [case-sensitive v]::sensing
should be added.
I have some other ideas, in order from best to worst.
  • An option in custom blocks, similar to run without screen refresh option, to make the contents of the block run scripts case-sensitively.
This would be useful to isolate case-sensitivity to certain scripts that need it, and it wouldn't be too confusing to new Scratchers.
  • An option in the edit section of the menu bar in the editor, similar to turbo mode, to toggle case sensitivity for the entire project.
This is an option, but it would mean changing the mechanics of the entire project instead of just a few scripts, and because turbo mode doesn't save (which it should, but that's another topic) case-sensitivity might not save either.
  • An option to make specific sprites case-sensitive.
This is another option, but it's not the best one because there are few scenarios where this would actually be useful.

I am a fan of the is exactly blocks, but these ideas are worth considering, too.

Powered by DjangoBB