BASIC

Author Topic: changing variable's value via FUNCTION  (Read 3431 times)

Offline Albert

  • Dr. Type
  • ****
  • Posts: 257
    • View Profile
    • Blog
Code: GLBasic [Select]
value=1

PRINT value,10,10

foo(value)

PRINT value,10,40

SHOWSCREEN
MOUSEWAIT

FUNCTION foo: val
  val=2
ENDFUNCTION
result:
1
1

How can I change a variable's value which i got as a parameter?

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10714
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
changing variable's value via FUNCTION
« Reply #1 on: 2008-Mar-07 »
function foo: BYREF var

Offline Albert

  • Dr. Type
  • ****
  • Posts: 257
    • View Profile
    • Blog
changing variable's value via FUNCTION
« Reply #2 on: 2008-Mar-07 »
Thanks a lot