Discuss Scratch
- Discussion Forums
- » Suggestions
- » Add Switch Blocks to Scratch
- Ekrcoaster
- Scratcher
18 posts
Add Switch Blocks to Scratch
So while I was learning Java, I came acrossed a switch that java has that works like this:
You enter a number to a value such as (2) and then java would run the 2nd code in the script. Confused? So am I!
Example:
Here is more information to hopefully make it less confusing
LESS CONFUSING JAVA TUTORIAL!
I know it would be the same as a bunch of if else blocks but it would be cool!
You enter a number to a value such as (2) and then java would run the 2nd code in the script. Confused? So am I!
Example:
when green flag clicked
if (2) then
first function
else
second function (This one will run!)
else
third function
end
Here is more information to hopefully make it less confusing
LESS CONFUSING JAVA TUTORIAL!
I know it would be the same as a bunch of if else blocks but it would be cool!
Last edited by Ekrcoaster (March 14, 2017 16:02:18)
–Ekrcoaster
Talk to an Artificial Intelligence I made! Meet Jova!
when I receive [morning v]
repeat until <(time) = [night]>
broadcast [code all day v]
end
stop [this script v]
- marscratcher
- Scratcher
100+ posts
Add Switch Blocks to Scratch
You can just do: So while I was learning Java, I came acrossed a switch that java has that works like this:
You enter a number to a value such as (2) and then java would run the 2nd code in the script. Confused? So am I!
Example:when green flag clicked
if (2) then
first function
else
second function (This one will run!)
else
third function
end
Here is more information to hopefully make it less confusing
LESS CONFUSING JAVA TUTORIAL!
I know it would be the same as a bunch of if else blocks but it would be cool!
if <1> then
func. 1
else
if <2> then
func. 2
else
func. 3
end
end
Marscratcher
- Ekrcoaster
- Scratcher
18 posts
Add Switch Blocks to Scratch
You can just do: So while I was learning Java, I came acrossed a switch that java has that works like this:
You enter a number to a value such as (2) and then java would run the 2nd code in the script. Confused? So am I!
Example:when green flag clicked
if (2) then
first function
else
second function (This one will run!)
else
third function
end
Here is more information to hopefully make it less confusing
LESS CONFUSING JAVA TUTORIAL!
I know it would be the same as a bunch of if else blocks but it would be cool!if <1> then
func. 1
else
if <2> then
func. 2
else
func. 3
end
end
I totally agree! It would be cool because it would add a new block and would simplify the script because it uses a number string rather then a Boolean.
–Ekrcoaster
Talk to an Artificial Intelligence I made! Meet Jova!
when I receive [morning v]
repeat until <(time) = [night]>
broadcast [code all day v]
end
stop [this script v]
- marscratcher
- Scratcher
100+ posts
Add Switch Blocks to Scratch
Oh i get it. I had an idea that you could right click and change how many “else” there are.You can just do: So while I was learning Java, I came acrossed a switch that java has that works like this:
You enter a number to a value such as (2) and then java would run the 2nd code in the script. Confused? So am I!
Example:when green flag clicked
if (2) then
first function
else
second function (This one will run!)
else
third function
end
Here is more information to hopefully make it less confusing
LESS CONFUSING JAVA TUTORIAL!
I know it would be the same as a bunch of if else blocks but it would be cool!if <1> then
func. 1
else
if <2> then
func. 2
else
func. 3
end
end
I totally agree! It would be cool because it would add a new block and would simplify the script because it uses a number string rather then a Boolean.
Last edited by marscratcher (March 15, 2017 01:53:31)
Marscratcher
- Ekrcoaster
- Scratcher
18 posts
Add Switch Blocks to Scratch
Oh i get it. I had an idea that you could right click and change how many “else” there are.You can just do: So while I was learning Java, I came acrossed a switch that java has that works like this:
You enter a number to a value such as (2) and then java would run the 2nd code in the script. Confused? So am I!
Example:when green flag clicked
if (2) then
first function
else
second function (This one will run!)
else
third function
end
Here is more information to hopefully make it less confusing
LESS CONFUSING JAVA TUTORIAL!
I know it would be the same as a bunch of if else blocks but it would be cool!if <1> then
func. 1
else
if <2> then
func. 2
else
func. 3
end
end
I totally agree! It would be cool because it would add a new block and would simplify the script because it uses a number string rather then a Boolean.
Great Idea! In Java that is how it works! Maybe they would add a plus sign at the bottom, in java you just type a new line of the case….
–Ekrcoaster
Talk to an Artificial Intelligence I made! Meet Jova!
when I receive [morning v]
repeat until <(time) = [night]>
broadcast [code all day v]
end
stop [this script v]
- marscratcher
- Scratcher
100+ posts
Add Switch Blocks to Scratch
This would actually be very useful with he pen coding I'm doing now.Oh i get it. I had an idea that you could right click and change how many “else” there are.You can just do: So while I was learning Java, I came acrossed a switch that java has that works like this:
You enter a number to a value such as (2) and then java would run the 2nd code in the script. Confused? So am I!
Example:when green flag clicked
if (2) then
first function
else
second function (This one will run!)
else
third function
end
Here is more information to hopefully make it less confusing
LESS CONFUSING JAVA TUTORIAL!
I know it would be the same as a bunch of if else blocks but it would be cool!if <1> then
func. 1
else
if <2> then
func. 2
else
func. 3
end
end
I totally agree! It would be cool because it would add a new block and would simplify the script because it uses a number string rather then a Boolean.
Great Idea! In Java that is how it works! Maybe they would add a plus sign at the bottom, in java you just type a new line of the case….
Marscratcher
- jromagnoli
- Scratcher
1000+ posts
Add Switch Blocks to Scratch
-snip-Then it would be a duplicate topic.
- Ekrcoaster
- Scratcher
18 posts
Add Switch Blocks to Scratch
This would actually be very useful with he pen coding I'm doing now.Oh i get it. I had an idea that you could right click and change how many “else” there are.You can just do: So while I was learning Java, I came acrossed a switch that java has that works like this:
You enter a number to a value such as (2) and then java would run the 2nd code in the script. Confused? So am I!
Example:when green flag clicked
if (2) then
first function
else
second function (This one will run!)
else
third function
end
Here is more information to hopefully make it less confusing
LESS CONFUSING JAVA TUTORIAL!
I know it would be the same as a bunch of if else blocks but it would be cool!if <1> then
func. 1
else
if <2> then
func. 2
else
func. 3
end
end
I totally agree! It would be cool because it would add a new block and would simplify the script because it uses a number string rather then a Boolean.
Great Idea! In Java that is how it works! Maybe they would add a plus sign at the bottom, in java you just type a new line of the case….
Cool! I really hope they add this
–Ekrcoaster
Talk to an Artificial Intelligence I made! Meet Jova!
when I receive [morning v]
repeat until <(time) = [night]>
broadcast [code all day v]
end
stop [this script v]
- braxbroscratcher
- Scratcher
1000+ posts
Add Switch Blocks to Scratch
Oh i get it. I had an idea that you could right click and change how many “else” there are.You can just do: So while I was learning Java, I came acrossed a switch that java has that works like this:
You enter a number to a value such as (2) and then java would run the 2nd code in the script. Confused? So am I!
Example:when green flag clicked
if (2) then
first function
else
second function (This one will run!)
Use an = block and a variable/custom block.
else
third function
end
Here is more information to hopefully make it less confusing
LESS CONFUSING JAVA TUTORIAL!
I know it would be the same as a bunch of if else blocks but it would be cool!if <1> then
func. 1
else
if <2> then
func. 2
else
func. 3
end
end
I totally agree! It would be cool because it would add a new block and would simplify the script because it uses a number string rather then a Boolean.
My signature is kumquat proof.
But not tangerine pro-
nomnomnomnomnom
- Paddle2See
- Scratch Team
1000+ posts
Add Switch Blocks to Scratch
duplicate.Thanks for the link! It does look like this is a duplicate topic so I'll close it to keep the conversation all in one place. This is a
Please use the existing topic in the link above.
Scratch Team Member, kayak and pickleball enthusiast, cat caregiver.
This is my forum signature! On a forum post, it is okay for Scratchers to advertise in their forum signature. The signature is the stuff that shows up below the horizontal line on the post. It will show up on every post I make.
(credit to Za-Chary)
;
- Discussion Forums
- » Suggestions
- » Add Switch Blocks to Scratch