Startseite › Foren › Deutsches LiveCode-Forum › function (hilfe bitte) › Antwort auf: function (hilfe bitte)
Juni 9, 2018 um 21:46 Uhr
#6060
Hallo daniromeo,
willkommen im Forum!
Leg die Funktion ins Stackskript, dann kannst Du sie von überall benutzen.
Hier ein Beispiel, wie man eine Funktion benutzt:
on mouseUp
ask "Bitte eine Zahl eingeben:"
put it into tZahl
## Sicher ist sicher!
if tZahl is not a number then
beep
exit mouseup
end if
put factorial(tZahl) into tFaku
answer "Die Fakultät von" && tZahl&& "ist" && tFaku
## Oder kürzer ohne den Umweg einer Variablen:
## answer "Die Fakultät von" && tZahl&& "ist" && factorial(tZahl)
end mouseUp
Hinweis: Ich würde keine zahl über 10 eingeben, dann explodiert Dein Rechner! 😀
Siehe auch:
Fakultät
Gruß
Klaus