0

I want to call the function by its name as string variable.

Help describes that I need to use the call():

call('ceil', [1.4])

But I am getting an error:

E129: Function name required

What am I doing wrong?

5

the confusing part here is that call is a command and call() is a function.

After : you cannot simply write foo(). You have to write a (ex-) command calling foo(), like in

call foo()    or
echo foo()    or
let a=foo()   and alike.

So in your example try :echo call('ceil', [1.4]) to see it working

  • 1
    The most confusing is call call('foo', []) – Alex Jul 23 '17 at 12:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.