I would like to know if it is possible to create a variable on the
fly.
This is my code:
let mylist = [f,g,m1,m2,m3]
let myvar = ['f','g','m1','m2','m3']
let i=0
while i <= 4
if strlen(mylist[i]) == strlen(mtot)-6
let s.myvar[i] = ' '
elseif strlen(mylist[i]) == strlen(mtot)-5
let s.myvar[i] = ' '
elseif strlen(mylist[i]) == strlen(mtot)-4
let s.myvar[i] = ' '
elseif strlen(mylist[i]) == strlen(mtot)-3
let s.myvar[i] = ' '
elseif strlen(mylist[i]) == strlen(mtot)-2
let s.myvar[i] = ' '
elseif strlen(mylist[i]) == strlen(mtot)-1
let s.myvar[i] = ' '
elseif strlen(mylist[i]) == strlen(mtot)
let s.myvar[i] = ''
endif
let i=i+1
endwhile
f,g = given by the user in un input box
m1,m2,m3,mtot = calculated before the while loop
explication:
let say f= 123 and mtot = 230030
the strlen(f) == srlen(mtot)-3 is valid
(3 == 6-3)
and has to create a new variable "sf" with as value 3 spaces ( ' ')
Can anyone tell me if it is possible to create a variable on the fly?
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php