Discuss 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:

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)

marscratcher
Scratcher
100+ posts

Add Switch Blocks to Scratch

Ekrcoaster wrote:

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!
You can just do:
if <1> then 

func. 1

else
if <2> then

func. 2

else
func. 3
end
end
Ekrcoaster
Scratcher
18 posts

Add Switch Blocks to Scratch

marscratcher wrote:

Ekrcoaster wrote:

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!
You can just do:
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.
marscratcher
Scratcher
100+ posts

Add Switch Blocks to Scratch

Ekrcoaster wrote:

marscratcher wrote:

Ekrcoaster wrote:

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!
You can just do:
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.
Oh i get it. I had an idea that you could right click and change how many “else” there are.

Last edited by marscratcher (March 15, 2017 01:53:31)

Ekrcoaster
Scratcher
18 posts

Add Switch Blocks to Scratch

marscratcher wrote:

Ekrcoaster wrote:

marscratcher wrote:

Ekrcoaster wrote:

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!
You can just do:
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.
Oh i get it. I had an idea that you could right click and change how many “else” there are.

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
Scratcher
100+ posts

Add Switch Blocks to Scratch

Ekrcoaster wrote:

marscratcher wrote:

Ekrcoaster wrote:

marscratcher wrote:

Ekrcoaster wrote:

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!
You can just do:
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.
Oh i get it. I had an idea that you could right click and change how many “else” there are.

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….
This would actually be very useful with he pen coding I'm doing now.
jromagnoli
Scratcher
1000+ posts

Add Switch Blocks to Scratch

marscratcher wrote:

-snip-
Then it would be a duplicate topic.
Ekrcoaster
Scratcher
18 posts

Add Switch Blocks to Scratch

marscratcher wrote:

Ekrcoaster wrote:

marscratcher wrote:

Ekrcoaster wrote:

marscratcher wrote:

Ekrcoaster wrote:

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!
You can just do:
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.
Oh i get it. I had an idea that you could right click and change how many “else” there are.

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….
This would actually be very useful with he pen coding I'm doing now.

Cool! I really hope they add this
braxbroscratcher
Scratcher
1000+ posts

Add Switch Blocks to Scratch

marscratcher wrote:

Ekrcoaster wrote:

marscratcher wrote:

Ekrcoaster wrote:

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!
You can just do:
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.
Oh i get it. I had an idea that you could right click and change how many “else” there are.
stickfiregames
Scratcher
1000+ posts

Add Switch Blocks to Scratch

This is a duplicate.
Paddle2See
Scratch Team
1000+ posts

Add Switch Blocks to Scratch

stickfiregames wrote:

This is a 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.

Please use the existing topic in the link above.

Powered by DjangoBB