cancel
Showing results for 
Search instead for 
Did you mean: 

print doubt

Creator
Creator

Hi everybody!

 

I need to print in console the name of the value insted of the value itself after a "for loop" , how can i do it?

 

have a nice day!

7 REPLIES

Re: print doubt

Phenom
Phenom
try

print "priority";

Steffen Bangsow
freelance simulation specialist  
web: www.bangsow.eu
mail: steffen@bangsow.net


Re: print doubt

Creator
Creator

I dont want the name of the array, i want the name of the variable that.

for example:

 

x = 1

y = 2

z = 3

 

priority = [ x, y, z].

 

after the for loop, in console should appear:

[z y x]

 

jajajajaja hope u can help me!

Re: print doubt

Valued Contributor
Valued Contributor
Hi.. Try This for local i := 8 downto 1 loop print priority [i]; next;

Re: print doubt

Phenom
Phenom

Hello

 

print "[", z, " ", y, " ", x, "]"

The above will print '[z y x]' as you asked, but the x, y and z will be replaced with the values of x, y and z variables.

 

JamesM

Re: print doubt

Phenom
Phenom

if x,y,z are global variables you can print the name of the global variables with

 

ref(globVar).name

 

or new syntax

 

&globVar.name


Steffen Bangsow
freelance simulation specialist  
web: www.bangsow.eu
mail: steffen@bangsow.net


Re: print doubt

Creator
Creator

And... how can i do it if its a local variable and its a part of a array?

Re: print doubt

Phenom
Phenom

i guess for local variables there is no other way as to write the names as strings like in the previos posts


Steffen Bangsow
freelance simulation specialist  
web: www.bangsow.eu
mail: steffen@bangsow.net