Discuss Scratch
- Lataliat
-
100+ posts
Is Letter, Number, or Symbol Block
No support. I've used a workaround for this many times:
Do this
And then use
All it requires,,, is being creative
Do this
add [1] to [list v]
And then use
<[list v] contains [answer] ?>
All it requires,,, is being creative

- Sheep_maker
-
1000+ posts
Is Letter, Number, or Symbol Block
In case you haven't read the rest of the discussion: No support. I've used a workaround for this many times:
Do thisadd [1] to [list v]
And then use<[list v] contains [answer] ?>
All it requires,,, is being creative
Well, the list can't have every number/symbol because first of all, there are TONS of symbols and an infinite number of numbers, so that list would be pretty long. You can have each symbol in a list (I.e. Numbers) and check of the list contains the symbol, so I don't support.
- Lataliat
-
100+ posts
Is Letter, Number, or Symbol Block
You can copy and paste the symbols as a string, and ‘extract’ them from that.Well, the list can't have every number/symbol because first of all, there are TONS of symbols and an infinite number of numbers, so that list would be pretty long. You can have each symbol in a list (I.e. Numbers) and check of the list contains the symbol, so I don't support.
Yes, but we use a finite amount of symbols to represent an infinite amount of combinations aka numbers, lol:
<[list v] contains (letter (1) of [number]) ?>You would need to, of course, add - and . to the list as well, if you wish to account for negatives and decimals.
(EDITED for typos. OH and I realize, this got necroposted!!

Last edited by Lataliat (Nov. 17, 2016 02:58:55)
- CodingJam
-
17 posts
Is Letter, Number, or Symbol Block
Sorry!please dont necropost, the last post was 2 years ago You could make a sprite with loads of costumes all named:
Other
as the first costume
al
bl
cl
dl
for all the letters
:s
's
#s
,s
for all the symbols.
Then you could make a block called letter, number, or symbol which looks like:define letter, number, or symbol(char)
switch costume to [other v]
switch costume to (char)
if <(costume #) = [1]> then
set [type v] to [number]
end
if <(letter (length of (char)) of (char)) = [l]> then
set [type v] to [letter]
end
if <(letter (length of (char)) of (char)) = [s]> then
set [type v] to [symbol]
end
Last edited by CodingJam (Dec. 28, 2022 09:43:49)
- dude341
-
1000+ posts
Is Letter, Number, or Symbol Block
Necroposting is allowed in the Suggestions forum.please dont necropost, the last post was 2 years ago You could make a sprite with loads of costumes all named:
Other
as the first costume
al
bl
cl
dl
for all the letters
:s
's
#s
,s
for all the symbols.
Then you could make a block called letter, number, or symbol which looks like:define letter, number, or symbol(char)
switch costume to [other v]
switch costume to (char)
if <(costume #) = [1]> then
set [type v] to [number]
end
if <(letter (length of (char)) of (char)) = [l]> then
set [type v] to [letter]
end
if <(letter (length of (char)) of (char)) = [s]> then
set [type v] to [symbol]
endSorry!
- aaronsacks2006
-
65 posts
Is Letter, Number, or Symbol Block
I don't care I still suport!please dont necropost, the last post was 2 years ago You could make a sprite with loads of costumes all named:
Other
as the first costume
al
bl
cl
dl
for all the letters
:s
's
#s
,s
for all the symbols.
Then you could make a block called letter, number, or symbol which looks like:define letter, number, or symbol(char)
switch costume to [other v]
switch costume to (char)
if <(costume #) = [1]> then
set [type v] to [number]
end
if <(letter (length of (char)) of (char)) = [l]> then
set [type v] to [letter]
end
if <(letter (length of (char)) of (char)) = [s]> then
set [type v] to [symbol]
end
- Flipped_
-
500+ posts
Is Letter, Number, or Symbol Block
please dont necropost, the last post was 2 years ago
I don't think there is necroposting in Suggestions, really.
- StrangeMagic32
-
1000+ posts
Is Letter, Number, or Symbol Block
Unless said suggestion is Rejected, or a Duplicateplease dont necropost, the last post was 2 years ago
I don't think there is necroposting in Suggestions, really.

OP,
if <((answer) * (1)) = (answer)> then
is number::grey
else
is letter or symbol::grey
end
Last edited by StrangeMagic32 (Feb. 22, 2019 00:32:19)
- dude341
-
1000+ posts
Is Letter, Number, or Symbol Block
You still can't find out whether something is a symbol or a letter though.Unless said suggestion is Rejected, or a Duplicateplease dont necropost, the last post was 2 years ago
I don't think there is necroposting in Suggestions, really.
OP,if <((answer) * (1)) = (answer)> then
is number::grey
else
is letter or symbol::grey
end
Plus, this workaround is not intuitive - a new scratcher would never guess this, as it relies on the way Scratch internally works and interprets strings and numbers. That behaviour could also easily change within an update, so the workaround is unreliable.

- StrangeMagic32
-
1000+ posts
Is Letter, Number, or Symbol Block
True that.You still can't find out whether something is a symbol or a letter though. OP,if <((answer) * (1)) = (answer)> then
is number::grey
else
is letter or symbol::grey
end
Plus, this workaround is not intuitive - a new scratcher would never guess this, as it relies on the way Scratch internally works and interprets strings and numbers. That behaviour could also easily change within an update, so the workaround is unreliable.
- ninjaMAR
-
1000+ posts
Is Letter, Number, or Symbol Block
support could use this a lot
this is not a necropost because this is the suggestions forum
this is not a necropost because this is the suggestions forum
- -Exphire-
-
1000+ posts
Is Letter, Number, or Symbol Block
support! this is because it would be hard for many new scratchers to understand how to detect numbers, and how do I detect symbols or letters? Here is one more use: you want to make an OS with a keyboard on the screen, and to bring up each category the player has to type a symbol in the category.
- MyRioName
-
100+ posts
Is Letter, Number, or Symbol Block
There are workarounds, but lets put it in the sticky about workarounds so people don't ask this again
I am not sure of any workarounds currently.
I am not sure of any workarounds currently.
- scratch978654
-
100+ posts
Is Letter, Number, or Symbol Block
Semi support, workaround: Ever had a project that had to use only numbers/letters/symbols? You might have to do something like this:when flag clickedWell, a good suggestion would be to have a block that detects if the string is a number, symbol, or letter, Like this!
forever
if <(answer) = (1)
end
if <(answer) = (2)
end
if <(answer) = (3)
end
if <(answer) = (4)
end
if <(answer) = (5)
end
if <(answer) = (6)
end
etc.([] is [number v])Here is an example of the new block in action:
([] is [letter v])
([] is [symbol v])When clickedSo basically, It is a Reporter block that would most likely be in the |Sensing| Section of the Block Palette.
ask [give me a number!] and wait
if <(answer) is [number v]> then
say [That's a cool number!]
else
say [Not a number :(]
end
If you say:say ((3) is [number v)then it will come out saying “True”.
This is my Idea, and please follow this Topic, and support!
if <([abs v] of (answer)) > [0]> then
Say number
else
Say string
end
- Seth_Zaw
-
100+ posts
Is Letter, Number, or Symbol Block
Workaround:
<((x)+(0))= (x)> // is a number
Last edited by Seth_Zaw (June 23, 2020 19:36:50)
- BosenChang
-
1000+ posts
Is Letter, Number, or Symbol Block
this is not a workaround:
when green flag clickedI see problem. Users could type in “…”
number or letter::custom
define number or letter
forever
set [letter v] to [a]
set [letter v] to [b]
set [letter v] to [c]
set [letter v] to [d]
...
end
ask [type in a number.] and wait
if <(answer) = <[a] or <[b] or <[c] or <...>>>> then
say [that is not a number.]
else
say [that is a number!]
end
Last edited by BosenChang (June 23, 2020 19:48:38)
- mlcreater
-
1000+ posts
Is Letter, Number, or Symbol Block
“Letter” is ambiguous because: is ‘å’ a letter? Is ‘θ’ a letter? They are, but many projects might only expect the letters abcdefghijklmnopqrstuvwxyz to return true in a "is [] a [letter v]“ block.
”Number“ is ambiguous because: is ‘Γ’ a number? Is ‘४’ a number? They are (representing three and four), but most projects might only expect the digits 0123456789 to return true in a ”is [] a [number v]“ block.
”Symbol" is ambiguous because: is ‘¢’ a symbol? Is ‘∂’ a symbol? They are (cent and partial differential), but in Requests, they can be used as letters (see the nougat shoppe and the nature shop).
”Number“ is ambiguous because: is ‘Γ’ a number? Is ‘४’ a number? They are (representing three and four), but most projects might only expect the digits 0123456789 to return true in a ”is [] a [number v]“ block.
”Symbol" is ambiguous because: is ‘¢’ a symbol? Is ‘∂’ a symbol? They are (cent and partial differential), but in Requests, they can be used as letters (see the nougat shoppe and the nature shop).
- modesties
-
100+ posts
Is Letter, Number, or Symbol Block
0:Semi support, workaround: Ever had a project that had to use only numbers/letters/symbols? You might have to do something like this:when flag clickedWell, a good suggestion would be to have a block that detects if the string is a number, symbol, or letter, Like this!
forever
if <(answer) = (1)
end
if <(answer) = (2)
end
if <(answer) = (3)
end
if <(answer) = (4)
end
if <(answer) = (5)
end
if <(answer) = (6)
end
etc.([] is [number v])Here is an example of the new block in action:
([] is [letter v])
([] is [symbol v])When clickedSo basically, It is a Reporter block that would most likely be in the |Sensing| Section of the Block Palette.
ask [give me a number!] and wait
if <(answer) is [number v]> then
say [That's a cool number!]
else
say [Not a number :(]
end
If you say:say ((3) is [number v)then it will come out saying “True”.
This is my Idea, and please follow this Topic, and support!if <([abs v] of (answer)) > [0]> then
Say number
else
Say string
end
why are we still hereanyway mockups:
just to suffer
every night
<is () a [number v]? ::operators>workaround for the number:
<is () a [string v]? ::operators>
<is () a [letter/sound v]? ::operators>
<is () a [positive v] ::operators>
<is () a [negative v] ::operators>
<is () a [decimal v] ::operators>
<is () a [zero v] ::operators>
<is () a [negative integer v] ::operators>
<is () a [integer v] ::operators>
<is () a [whole v] ::operators>
<is () a [natural v] ::operators>
define is (input) a numberworkaround for string:
if <((input) * (1)) = (input)> then
set [result v] to [true]
else
set [result v] to [false]
end
define is (input) a string
if <((input) * (1)) = (input)> then
set [result v] to [false]
else
set [result v] to [true]
end
workaround for letter/sound:
define is (input) a letter/sound
is (input) a string ::custom block
if <<(result) = [true]> and <(length of (input)) = [1]>> then
stop [this script v]
end
set [result v] to [false]
Last edited by modesties (Oct. 10, 2021 22:39:55)
- Reev0102
-
1000+ posts
Is Letter, Number, or Symbol Block
((foo) / (1)) = (foo) // if this is true, it's a number. If it's false, it's a letter or symbol.
- Multi-Coders
-
5 posts
Is Letter, Number, or Symbol Block
I definitely support this. Yes, you could add numbers to a list, and use the answer block, but that looks un-professional. I use number keys to pick choices, and that DOESN'T use the answer block.
Last edited by Multi-Coders (Dec. 7, 2022 00:24:38)