• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Assigning string variable inside for loop

 
Gopu Akraju
Ranch Hand
Posts: 242
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have initially decalred string variables as follow:

And trying to assign the data inside a for loop as below:



But I always get error inside for loop (line 3 and 4).
Thanks in advance.

>
 
Mike Simmons
Ranch Hand
Posts: 3028
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, what does the error message say?
 
Gopu Akraju
Ranch Hand
Posts: 242
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Simon,

error says "can not find symbol lib"
 
Henry Wong
author
Marshal
Pie
Posts: 20882
75
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gopu Akraju wrote:
error says "can not find symbol lib"


Well... did you declare a variable name "lib"?

Henry
 
Gopu Akraju
Ranch Hand
Posts: 242
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Henry,
I have declared them as in line 1.


I want to loop these variables without writing like



I don't get any errors in the above lines. Where as I am trying do this inside a for loop.
 
Henry Wong
author
Marshal
Pie
Posts: 20882
75
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gopu Akraju wrote:
I have declared them as in line 1.



I think you need to brush up on array variables. Declaring eight different variables whose name happen to start with "lib", is not the same as declaring a "lib" array variable.

Henry
 
Gopu Akraju
Ranch Hand
Posts: 242
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. Henry. I have changed my code as suggested.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic