Jump to content

Recommended Posts

Posted

I would like to use a variable and after it is used re-use it again but before that it needs to be rest to nothing. When I do the following:

dim $test

$test="Dummy"

msgbox(4096,"",$test)

dim $test

msgbox(4096,"",$test)

The result is that $test is still comes back with Dummy.

In the help file it is stated that Dim for the same variable name will erase and reset the dimensions to the new definition.

Please help me out!!!!!! :lmao:

Posted (edited)

I would like to use a variable and after it is used re-use it again but before that it needs to be rest to nothing. When I do the following:

dim $test

$test="Dummy"

msgbox(4096,"",$test)

dim $test

msgbox(4096,"",$test)

The result is that $test is still comes back with Dummy.

In the help file it is stated that Dim for the same variable name will erase and reset the dimensions to the new definition.

Please help me out!!!!!!  :lmao:

<{POST_SNAPBACK}>

if it's in the same scope, why not just use $test="" ?

EDIT:

btw, you interpreted it wrong it says:

erase and reset the dimensions to the new definition

DIMENSIONS not VALUE!

Edited by closeupman
Posted

That is also what I figured out but then I need to set all my variables to "" and with DIM I can just place all my variables after eachtother like: DIM $test, $test1, $test2 and so on.

Posted

That is also what I figured out but then I need to set all my variables to "" and with DIM I can just place all my variables after eachtother like: DIM $test, $test1, $test2 and so on.

<{POST_SNAPBACK}>

ya...i think you're out of luck...that resetting I believe applies to arrays also anyways( that's y there's redim and dim, redim preserves values for arrays)

The ReDim keyword is similar to Dim, except that ReDim preserves the values in the array instead of removing the values while resizing an array

Best thing is just $test="" or dim $test="",$test2="" ....

or if wanna get fancy and more comprehensible what u're up to:

dim $a,$b=6

msgbox(0,"",$b,2)

$b=_reset()

msgbox(0,"",$b,2)

func _reset()

Return ("")

EndFunc

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...