Alice Community

Alice Community (http://www.alice.org/community/index.php)
-   Questions and Comments (http://www.alice.org/community/forumdisplay.php?f=9)
-   -   what is (http://www.alice.org/community/showthread.php?t=1125)

Stewartmiddlemagnetschool 12-27-2007 08:06 PM

what is
 
what is the diffrence between if the and if else please responde asap
thanx

DickBaldwin 12-27-2007 08:29 PM

[quote=Stewartmiddlemagnetschool;4377]what is the diffrence between if the and if else please responde asap
thanx[/quote]

I'm not sure what you mean by "if the" However, here is the explanation that you probably need.

The if-else construct looks something like this in pseudocode:

if(something is true){
do a particular thing
} else, meaning that it is not true{
do something different
}

In most programming languages, you can leave the else-clause off leaving only the if-clause. In that case, the meaning is something like the following:

if(it is not raining){
play baseball
}end of the statement

In Alice, you can't leave the else-clause off. However, you can leave it empty, which is functionally the same as leaving if off.

Perhaps you need to spend some time with the free online Alice tutorials listed below.

Dick Baldwin
Free Alice tutorials: [URL]http://www.dickbaldwin.com/tocalice.htm[/URL]
Free programming tutorials: [URL]http://www.dickbaldwin.com/toc.htm[/URL]

DrJim 12-28-2007 05:05 PM

In case "the" was a typo and you meant "then".

In some older languages, the if statement was actually written "if (condition) then (do something)". The "then" can often be (or is required to be) omitted , however, and resulting statement "if (condition) (do something) does the same as the first pseudocode.

Either one can nearly always be followed by one or a series of "else (do something else)" statments.


All times are GMT -5. The time now is 03:47 PM.

Copyright ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.