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

#1 2012-03-24 09:15:19

Qaze
Scratcher
Registered: 2010-10-02
Posts: 56

Operaters

Is there a "through" block? for example, if 'variable' equals '1-5'?
How do you get if so?
Ty


http://i.imgur.com/2i8VY.gif

Offline

 

#2 2012-03-24 09:30:55

PullJosh
Scratcher
Registered: 2011-08-01
Posts: 500+

Re: Operaters

There isn't. If you want one, you could go the the suggestions forum and see about that whole thing. I think this script could replace it though:

if <<(variable) < ([high number] + (1))> and <(variable) > ([low number] - (1))>>
then do stuff
end
I think it will work, but I'm not sure.

Last edited by PullJosh (2012-03-24 09:33:35)


http://www.blocks.scratchr.org/API.php?action=text&amp;string=I'm_on_vacation!&amp;xpos=155&amp;ypos=90&amp;font_size=30&amp;bgimage=http://imageshack.us/a/img339/7215/sspeechsigapiforwords.png

Offline

 

#3 2012-03-24 10:53:28

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: Operaters

PullJosh wrote:

There isn't. If you want one, you could go the the suggestions forum and see about that whole thing. I think this script could replace it though:

if <<(variable) < ([high number] + (1))> and <(variable) > ([low number] - (1))>>
then do stuff
end
I think it will work, but I'm not sure.

That will cause glitches when working with decimals.  Use this instead:

if < <not <(input) > (high)> > and <not <(input) < (low) > > >
do stuff
end

Last edited by Greenatic (2012-03-24 10:54:23)

Offline

 

#4 2012-03-24 12:49:48

Qaze
Scratcher
Registered: 2010-10-02
Posts: 56

Re: Operaters

Greenatic wrote:

PullJosh wrote:

There isn't. If you want one, you could go the the suggestions forum and see about that whole thing. I think this script could replace it though:

if <<(variable) < ([high number] + (1))> and <(variable) > ([low number] - (1))>>
then do stuff
end
I think it will work, but I'm not sure.

That will cause glitches when working with decimals.  Use this instead:

if < <not <(input) > (high)> > and <not <(input) < (low) > > >
do stuff
end

Thanks, i'll try it out.

Last edited by Qaze (2012-03-24 12:50:06)


http://i.imgur.com/2i8VY.gif

Offline

 

Board footer