Alice Community  

Go Back   Alice Community > General Discussion > Questions and Comments

Reply
 
Thread Tools Display Modes
what is
Old
Stewartmiddlemagnetschool
Guest
 
Status:
Posts: n/a
Default what is - 12-27-2007, 08:06 PM

what is the diffrence between if the and if else please responde asap
thanx
   
Reply With Quote
Old
DickBaldwin
Guest
 
Status:
Posts: n/a
Default 12-27-2007, 08:29 PM

Quote:
Originally Posted by Stewartmiddlemagnetschool View Post
what is the diffrence between if the and if else please responde asap
thanx
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: http://www.dickbaldwin.com/tocalice.htm
Free programming tutorials: http://www.dickbaldwin.com/toc.htm

Last edited by DickBaldwin; 12-27-2007 at 08:30 PM. Reason: clarification
   
Reply With Quote
Old
DrJim
Guest
 
Status:
Posts: n/a
Default 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.
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



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