This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2013-01-26 20:02:07

awesomedude214
Scratcher
Registered: 2012-11-21
Posts: 21

How do I use operators and what do they do?

Hi Scratch. Ive seen people use operators in their projects but I dont know how to use them!! please reply!

Offline

 

#2 2013-01-26 20:08:16

Blayer98
Scratcher
Registered: 2012-03-22
Posts: 100+

Re: How do I use operators and what do they do?

Operators are really useful in a few ways, but i'll list the easiest one here.

when gf clicked
repeat until <(Bang) = [1]>
  play sound [Magic Wand v]
end
stop script


http://i50.tinypic.com/16lwmlj.png
The first Collab to have it's very own Cloud Variables! Coming Soon!

Offline

 

#3 2013-01-27 10:16:28

fetchydog567
Scratcher
Registered: 2011-12-28
Posts: 500+

Re: How do I use operators and what do they do?

awesomedude214 wrote:

Hi Scratch. Ive seen people use operators in their projects but I dont know how to use them!! please reply!

((3) + (2))
If you click this it will say " 5"

Last edited by fetchydog567 (2013-01-27 10:17:16)


http://www.minecraftanonymous.com/assets/banners/banner_51.pngJust a reminder I won't be on Scratch that much but I 'll still be here, so if i'm on something, I will be commenting back, okay! wink , PICO Team!!!!!!!!!!! SCRATCH DEADW!!! PICO HACK ACCOUTNTT@@

Offline

 

#4 2013-01-27 13:12:17

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: How do I use operators and what do they do?

awesomedude214 wrote:

Hi Scratch. Ive seen people use operators in their projects but I dont know how to use them!! please reply!

Well operators are what they seem like; some add, some subtract, some divide, and so on. If you ever want to use them, just fill out the 1~2 text boxes in it, then put it in a drop down menu, a round space of a block, in more operators, or in the booleans (=, >, <). So for example, here's a sample script using operators:

when gf clicked
set [variable v] to (1)
if <(((variable) + (2)) * (2)) < (9)>
 switch to costume ((variable) + (1))
end

I hope that this helps!

Last edited by ErnieParke (2013-01-27 13:12:27)


http://i46.tinypic.com/35ismmc.png

Offline

 

#5 2013-01-27 13:26:29

berberberber
Scratcher
Registered: 2012-03-08
Posts: 1000+

Re: How do I use operators and what do they do?

Operators are like mathmatical equations.


http://i47.tinypic.com/2iaa73k.png

Offline

 

#6 2013-01-28 06:49:07

Aditya007
Scratcher
Registered: 2012-11-27
Posts: 63

Re: How do I use operators and what do they do?

They are actually very helpful in ute projects, fire example:
1. If any variable is equal, do whatever  then you can use ' equal to' operator.
2. You can make a calculator using plus minus multiplication division mod, etc
3. They are also used in mathematical simulations
* There are many other things too, try them yourselves


Wolf_OS!!!  smile  Check My Stuff  tongue  Need Help?  Currently, I am http://blocks.scratchr.org/API.php?user=Aditya007&amp;action=onlineStatus&amp;type=square
http://i49.tinypic.com/15gy1j6.jpg

Offline

 

#7 2013-01-28 11:57:38

Locomule
Scratcher
Registered: 2009-08-24
Posts: 500+

Re: How do I use operators and what do they do?

right click on them for specific help from Scratch


aka Pain from DragonSpires, Delrith Online, BotBattle, Urban Dead etc etc lol

Offline

 

#8 2013-04-21 12:32:34

kattenelvis
Scratcher
Registered: 2013-02-06
Posts: 100+

Re: How do I use operators and what do they do?

what does the operators longest down do? like hello world and sqrt and <10 ?

([sqrt] by 10)

Last edited by kattenelvis (2013-04-21 12:35:40)


http://i38.tinypic.com/35b8d4n.png

Offline

 

#9 2013-04-21 13:57:40

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: How do I use operators and what do they do?

kattenelvis wrote:

what does the operators longest down do? like hello world and sqrt and <10 ?

([sqrt v] of 10)

Well the join operator (which I think i you're talking about) just joins whatever you put into the two boxes. For example, this:

(join [Hello] [ a pie!])

Will give you "Hello a pie!"

As for the sqrt operator, it's actually short for square root. It figures out what number, when multiplied by itself, will give you the number you entered. For example:

([sqrt v] of (9))

This will give you 3 because 3 times itself will give you 9.

Finally, the 10^ operator multiples 10 as many times as you entered into the blank space. For example:

([10 ^ v] of (3))

This will give you 1,000 because that's what 10*10*10 is.

Well I hope that I hit all of them. Also, I hope that this helped!

With regards,

ErnieParke

Last edited by ErnieParke (2013-04-21 13:57:56)


http://i46.tinypic.com/35ismmc.png

Offline

 

#10 2013-04-21 14:05:24

kattenelvis
Scratcher
Registered: 2013-02-06
Posts: 100+

Re: How do I use operators and what do they do?

ErnieParke wrote:

kattenelvis wrote:

what does the operators longest down do? like hello world and sqrt and <10 ?

([sqrt v] of 10)

Well the join operator (which I think i you're talking about) just joins whatever you put into the two boxes. For example, this:

(join [Hello] [ a pie!])

Will give you "Hello a pie!"

As for the sqrt operator, it's actually short for square root. It figures out what number, when multiplied by itself, will give you the number you entered. For example:

([sqrt v] of (9))

This will give you 3 because 3 times itself will give you 9.

Finally, the 10^ operator multiples 10 as many times as you entered into the blank space. For example:

([10 ^ v] of (3))

This will give you 1,000 because that's what 10*10*10 is.

Well I hope that I hit all of them. Also, I hope that this helped!

With regards,

ErnieParke

what is it used for? and what does all the other ones meen?


http://i38.tinypic.com/35b8d4n.png

Offline

 

#11 2013-04-21 17:14:11

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: How do I use operators and what do they do?

kattenelvis wrote:

ErnieParke wrote:

kattenelvis wrote:

what does the operators longest down do? like hello world and sqrt and <10 ?

([sqrt v] of (10))

Well the join operator (which I think i you're talking about) just joins whatever you put into the two boxes. For example, this:

(join [Hello] [ a pie!])

Will give you "Hello a pie!"

As for the sqrt operator, it's actually short for square root. It figures out what number, when multiplied by itself, will give you the number you entered. For example:

([sqrt v] of (9))

This will give you 3 because 3 times itself will give you 9.

Finally, the 10^ operator multiples 10 as many times as you entered into the blank space. For example:

([10 ^ v] of (3))

This will give you 1,000 because that's what 10*10*10 is.

Well I hope that I hit all of them. Also, I hope that this helped!

With regards,

ErnieParke

what is it used for? and what does all the other ones meen?

Well, I'm not entirely sure what you mean by other ones, so could you say them?

As for the join block, that's used when you need to join text. For example, let's say that you want to ask the player for their name:

ask [What's your name?] and wait
say (join (join [Hello ](answer))[!])

The other operators are used mainly in math.

Well, I hope that that cleared some things up.

With regards,

ErnieParke


http://i46.tinypic.com/35ismmc.png

Offline

 

#12 2013-04-23 12:50:06

kattenelvis
Scratcher
Registered: 2013-02-06
Posts: 100+

Re: How do I use operators and what do they do?

ErnieParke wrote:

kattenelvis wrote:

ErnieParke wrote:

Well the join operator (which I think i you're talking about) just joins whatever you put into the two boxes. For example, this:

(join [Hello] [ a pie!])

Will give you "Hello a pie!"

As for the sqrt operator, it's actually short for square root. It figures out what number, when multiplied by itself, will give you the number you entered. For example:

([sqrt v] of (9))

This will give you 3 because 3 times itself will give you 9.

Finally, the 10^ operator multiples 10 as many times as you entered into the blank space. For example:

([10 ^ v] of (3))

This will give you 1,000 because that's what 10*10*10 is.

Well I hope that I hit all of them. Also, I hope that this helped!

With regards,

ErnieParke

what is it used for? and what does all the other ones meen?

Well, I'm not entirely sure what you mean by other ones, so could you say them?

As for the join block, that's used when you need to join text. For example, let's say that you want to ask the player for their name:

ask [What's your name?] and wait
say (join (join [Hello ](answer))[!])

The other operators are used mainly in math.

Well, I hope that that cleared some things up.

With regards,

ErnieParke

what i mean with the others is:

(10)mod(10)

round (10)

[abs] of (10)

[sin] of (10)

[cos] of (10)

[tan] of (10)

[asin] of (10)


e.t.c

Last edited by kattenelvis (2013-04-23 12:50:57)


http://i38.tinypic.com/35b8d4n.png

Offline

 

#13 2013-04-23 15:55:58

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: How do I use operators and what do they do?

kattenelvis wrote:

ErnieParke wrote:

kattenelvis wrote:

what is it used for? and what does all the other ones meen?

Well, I'm not entirely sure what you mean by other ones, so could you say them?

As for the join block, that's used when you need to join text. For example, let's say that you want to ask the player for their name:

ask [What's your name?] and wait
say (join (join [Hello ](answer))[!])

The other operators are used mainly in math.

Well, I hope that that cleared some things up.

With regards,

ErnieParke

what i mean with the others is:

(10)mod(10)

round (10)

[abs] of (10)

[sin] of (10)

[cos] of (10)

[tan] of (10)

[asin] of (10)


e.t.c

Oh. That's quite a list.

Well, to start off, the mod block does a bit of a fancy operation. When you divide a number by another, it's not always going to go in a whole number of times. For example, 3 goes into 8 2 times. Or, 8/3 = 2, plus of course, a remainder of 2. This mod block gives you that remainder. It's mainly used in infinite-something projects, though there are other uses.


The round block basically rounds a number to the nearest number. So:

round (2.4) = 2

round (2.6) = 3

round (123.1) = 123

round (-2) = -2

It's used in various situation


Moving on. The abs (short for absolute) block basically does nothing to a number, other then make it positive. For example:

abs(-2) = 2

abs(3) = 3

Simple, right?


Finally, the sin(), cos(), and tan() are all functions used in trigonometry to find out information about a triangle, mainly side lengths. So, if you had 2 angles and a side, then you could find the length of the two other sides and the measure the size of the final angle.

As for the asin(), acos(), and atan(), they do the same thing as above, though they help with angles.


Well, that's about it! If you have any questions, which you probably will, just ask.

With regards,

ErnieParke


http://i46.tinypic.com/35ismmc.png

Offline

 

#14 2013-04-23 16:18:54

joshuaho
Scratcher
Registered: 2012-08-20
Posts: 100+

Re: How do I use operators and what do they do?

awesomedude214 wrote:

Hi Scratch. Ive seen people use operators in their projects but I dont know how to use them!! please reply!

Operators do lots of things. They join things, such as this:

if <(score)> = [10]// the operator here enables you to add a variable. It says that if the score equals 10, then broadcast. That is how a operator works
broadcast [you win]
If suppose you made a game making the sprite say your score, you need a operator.
say join [this is your] (score)//operators also enable a sprite to say something joined with a variable.
Operators also join 2 things together.
when gf clicked
move (10) steps
if <touching sprite 2> or < touching sprite 3> // this gives the sprite 2 options. If touching this or that...
hide//do this
when gf clicked
move (10) steps
if<touching sprite 2> and <touching sprite 3>// this tells the sprite to hide if it touches [b]both of those sprites[/b]
hide
Those are operators. They are very useful during programming.


Did you know that you can go to space and see Mars by clicking here?

Offline

 

#15 2013-04-23 16:35:23

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: How do I use operators and what do they do?

joshuaho wrote:

awesomedude214 wrote:

Hi Scratch. Ive seen people use operators in their projects but I dont know how to use them!! please reply!

Operators do lots of things. They join things, such as this:

if <(score) = [10]>// the operator here enables you to add a variable. It says that if the score equals 10, then broadcast. That is how a operator works
broadcast [you win v]
end
If suppose you made a game making the sprite say your score, you need a operator.
say (join [this is your] (score))//operators also enable a sprite to say something joined with a variable.
Operators also join 2 things together.
when gf clicked
move (10) steps
if <<touching [sprite 2 v]?> or <touching [sprite 3 v]?>> // this gives the sprite 2 options. If touching this or that...
hide//do this
end
when gf clicked
move (10) steps
if <<touching [sprite 2 v]?> and <touching [sprite 3 v]?>>// this tells the sprite to hide if it touches [b]both of those sprites[/b]
hide
end
Those are operators. They are very useful during programming.

I fixed your code. Mainly, you forgot <>'s in various places, and you forgot to cap of your if's with an "end"

With regards,

ErnieParke

Last edited by ErnieParke (2013-04-23 16:35:58)


http://i46.tinypic.com/35ismmc.png

Offline

 

#16 2013-04-24 15:50:24

joshuaho
Scratcher
Registered: 2012-08-20
Posts: 100+

Re: How do I use operators and what do they do?

ErnieParke wrote:

joshuaho wrote:

awesomedude214 wrote:

Hi Scratch. Ive seen people use operators in their projects but I dont know how to use them!! please reply!

Operators do lots of things. They join things, such as this:

if <(score) = [10]>// the operator here enables you to add a variable. It says that if the score equals 10, then broadcast. That is how a operator works
broadcast [you win v]
end
If suppose you made a game making the sprite say your score, you need a operator.
say (join [this is your] (score))//operators also enable a sprite to say something joined with a variable.
Operators also join 2 things together.
when gf clicked
move (10) steps
if <<touching [sprite 2 v]?> or <touching [sprite 3 v]?>> // this gives the sprite 2 options. If touching this or that...
hide//do this
end
when gf clicked
move (10) steps
if <<touching [sprite 2 v]?> and <touching [sprite 3 v]?>>// this tells the sprite to hide if it touches [b]both of those sprites[/b]
hide
end
Those are operators. They are very useful during programming.

I fixed your code. Mainly, you forgot <>'s in various places, and you forgot to cap of your if's with an "end"

With regards,

ErnieParke

Thank you.  smile  I am not a expert on making scratchblocks, so that explains why I am not that good.


Did you know that you can go to space and see Mars by clicking here?

Offline

 

#17 2013-04-24 16:26:44

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: How do I use operators and what do they do?

joshuaho wrote:

ErnieParke wrote:

joshuaho wrote:


Operators do lots of things. They join things, such as this:

if <(score) = [10]>// the operator here enables you to add a variable. It says that if the score equals 10, then broadcast. That is how a operator works
broadcast [you win v]
end
If suppose you made a game making the sprite say your score, you need a operator.
say (join [this is your] (score))//operators also enable a sprite to say something joined with a variable.
Operators also join 2 things together.
when gf clicked
move (10) steps
if <<touching [sprite 2 v]?> or <touching [sprite 3 v]?>> // this gives the sprite 2 options. If touching this or that...
hide//do this
end
when gf clicked
move (10) steps
if <<touching [sprite 2 v]?> and <touching [sprite 3 v]?>>// this tells the sprite to hide if it touches [b]both of those sprites[/b]
hide
end
Those are operators. They are very useful during programming.

I fixed your code. Mainly, you forgot <>'s in various places, and you forgot to cap of your if's with an "end"

With regards,

ErnieParke

Thank you.  smile  I am not a expert on making scratchblocks, so that explains why I am not that good.

Well, if you wait a bit more, you might just become an expert on scratchblocks. ;)

By the way, it was nothing.

With regards,

ErnieParke


http://i46.tinypic.com/35ismmc.png

Offline

 

Board footer