ist global die einzige Möglichkeit wenn ich die Variable test leeren möchte?
Code: Select all
msgbox % test() ; 1
msgbox % test() ; 2
msgbox % test() ; 3
msgbox % test() ; 4
test := 0
msgbox % test() ; 1
test() {
global test
test++
return test
}
Moderator: jNizM
Code: Select all
msgbox % test() ; 1
msgbox % test() ; 2
msgbox % test() ; 3
msgbox % test() ; 4
test := 0
msgbox % test() ; 1
test() {
global test
test++
return test
}
Code: Select all
msgbox % test() ; 1
msgbox % test() ; 2
msgbox % test() ; 3
msgbox % test() ; 4
msgbox % test(True) ; 1
Test(Init := False) {
Static Test:= 0
If Init
Test := 0
Return ++Test
; alternativ (Ternary):
; Return (Init ? Test := 1 : ++Test)
}
Users browsing this forum: No registered users and 22 guests