Difference between if and elsif

Asked

Viewed 1,393 times

1

I know these two terms don’t exist in the same language (correct me if I’m wrong), but in some languages (C#, in the example below), we have the following code:

if(condicao){

...

} else if (condicao) {

 ...

}

In others (Perl, in the example below), we have:

if (condicao) {
    ...
}
elsif (condicao) {
    ...
}

The two probably do the same thing, but is there any difference in their logic? Or in the way they are interpreted/compiled by the computer? Or is it just related to the syntax of the language itself?

1 answer

6


else if, elseif, elsif, elif, and other forms are just different ways of writing the same thing, probably each one is in accordance with the philosophy of syntax. There is no difference in their execution, but nothing prevents some language from doing something different, it just doesn’t make sense, it would just confuse.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.