Thursday, January 19, 2023

Using Vim9 for a function


I'm using vim 9.1221 on Windows 10. I tried to create a function using
Vim9, as in:

def! Foo(a: float, b: float): float
  return a + b
enddef

If I call Foo(1.2, 5.0) I get the answer 6.2

but if I call Foo(1.2, 5) I get:

E1013: Argument 2:type mismatch, expected float but got number

How can I modify the function to make it possible to call Foo(1.2, 5)
and get a result.

Many thanks in advance,

--
Cesar

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/84364d7b-916a-4e85-ab3c-b7009efb7176n%40googlegroups.com.

No comments:

Post a Comment