2

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?

1 Answer 1

6

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
  • 2
    The most confusing is call call('foo', [])
    – Alex
    Commented Jul 23, 2017 at 12:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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