05-22-2025, 03:00 PM
(This post was last modified: 05-22-2025, 03:01 PM by Kernelpanic.)
(05-21-2025, 11:35 AM)bplus Wrote: SMcNeill: "I'm not certain what "unless you tell them to" refers to"This way, nothing happens because the function exits before x = x + 1.
It refers to exactly what you showed in your example:
FUNCTION foo (x)
foo = 2 * x
X = x + 1 ' <<< here Steve told the function to change the variable! not normally done with functions
END FUNCTION
Code: (Select All)
Dim As Integer x
x = 4
Print Using "Ergebnis: ###.###"; foo(x)
Function foo (x)
foo = 2 * x
x = x + 1
End Function
This makes sense.
Code: (Select All)
Dim As Integer x
x = 4
Print Using "Ergebnis: ###.###"; foo(x)
Function foo (x)
x = x + 1
foo = 2 * x
'x = x + 1
End Function
![[Image: Funktion-Anordnung-Falsch.jpg]](https://i.ibb.co/FbNCJC6B/Funktion-Anordnung-Falsch.jpg)