Variable name Vs Value variable

Hello,
I have 3 variables: var1 = 10; var2 = 20; var3 = 30

I would like to print on screen the variable with for cycle

sub prova
dim var1#
dim var2#
dim var3#

var1 = 10
var2 = 20
var3 = 30	
for i = 1 to 3
    print "var" & i
next
end sub

But in this way obtain the of variable, not the value

Can you help me?

Thank you

You explicitly order to output a string constant with the string value var every time. The current value of i is then automatically also converted to string and appended.

You cannot access the value of a variable by a string in place of the variable itself.

To achieve what you wanted you need to make the three values accessible by index. One way to do so would be:

Sub someOutput()
Dim myArray
myArray = Array(10, 20, 30)
For i = 0 to 2     'Arrays created by the standard function Array() start with index 0.
    Print myArray(i)
Next i
End Sub

To make values accessible via string values used as names you need to create a structured variable of a different type. The names then are still strings viewed from Basic, not variables.

Pöease don’t miss to add the tag “basic” to your question. Even better you replace “calc” with “basic” because the question isn’t related to Calc.

Thank you Lupp,
P.S. After clicking “Retag” and modifing it, how to conferm?

Sorry. Retagging doesn’t seem to work. I also tried some ways but failed.
I found the respective question here but no answer.

I retagged it by clicking retag, entering common basic variable name and then clicking outside the entry box. @Lupp, perhaps you tried to enter basic variable name, but this will not be accepted because either calc or common is required, as explained at What makes a good tag? - #19 by jimk.

Thanks @jimk .
I also had added common. I obviously missed the expcted sequel.
And: I missed to hint @Fede1 to the fact that there are a few predefined tags one of which to use is mandatory.