else

This forum serves as MSCI Reference at EGOSOFT. It's Read-Only for non MSCI Group members.

Moderators: Scripting / Modding Moderators, MSCI Moderators

Locked
mark_a_condren
Posts: 1385
Joined: Wed, 3. Aug 05, 05:05
x3tc

else

Post by mark_a_condren » Fri, 10. Sep 10, 15:53

else


Ends the primary code block for an 'if' statement and begins the alternative execution code block
(the block that is executed in the case that the 'if' statement's test is negative)

Often used when consecutive closely related 'if' conditions fail to do something completly different.


Example:

$value = 10

if $value > 20
| write to player logbook 'Value is above 20'
else
| write to player logbook 'Value is equal to or below 20'
end

In this case the 'if' condition fails so the 'else' condition is used.


Command Location:

Alex Vanderbilt
Winner X3 Sektorquest
Posts: 2119
Joined: Thu, 4. May 06, 12:07
x3tc

[TiP][49] 286638

Post by Alex Vanderbilt » Fri, 1. Oct 10, 14:22

else

Der primäre Codeblock einer if-Abfrage wird beendet und ein alternativer Codeblock wird ausgeführt.
(Der Block wird ausgeführt, für den Fall, dass die if-Abfrage negativ ausfällt.)

Häufig benutzt, wenn aufeinanderfolgende und eng zusammenhängende if-Bedingungen daran scheitern, etwas komplett anderes zu machen.

Beispiel:

$value = 10

if $value > 20
| write to player logbook 'Wert ist größer als 20'
else
| write to player logbook 'Wert ist kleiner oder gleich 20'
end

In diesem Fall schlägt die if-Bedingung fehl und es wird stattdessen die else-Bedingung ausgeführt.


Zu finden unter:

User avatar
Capux
Posts: 2141
Joined: Sat, 31. Oct 09, 22:17
x4

[39] 286638

Post by Capux » Thu, 21. Oct 10, 21:24

else


Chiude il blocco principale di un'istruzione 'if' ed inizia il blocco di codice da eseguire in alternativa (il codice da eseguire nel caso l'istruzione 'if' abbia esito negativo).

Spesso usato per far eseguire un'alternativa completamente diversa nel caso l'istruzione 'if' fallisca.


Esempio:

$value = 10

if $value > 20
| write to player logbook 'Value is above 20'
else
| write to player logbook 'Value is equal to or below 20'
end

Nel caso non si verifichino le condizioni per l'istruzione 'if', viene usato il blocco 'else'.


Posizione dell'istruzione nella lista:

Locked

Return to “MSCI Reference”