Problem with one function - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1) +--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3) +---- Forum: Help Me! (https://qb64phoenix.com/forum/forumdisplay.php?fid=10) +---- Thread: Problem with one function (/showthread.php?tid=1946) |
Problem with one function - Kernelpanic - 08-29-2023 The function expects a double, but should return a string. Is this possible? It is about replacing the Saxon point with a comma in a German edition. The program works, and I want to wrap that in a function. But the function doesn't want to. "Illegal string-number conversion" - where? Maybe someone knows where the error is? Thanks! This is OK: Code: (Select All)
The function gives the error message (punktKomma = zk_zahl -- Line 50) Code: (Select All)
RE: Problem with one function - DSMan195276 - 08-29-2023 You need to declare `punktKomma` with a `$`, so `punktKomma$`. Note that in QB64 the `DECLARE` lines are unnecessary and ignored, so unfortunately there's no warning or error about how your declaration (which has `As String`) doesn't match the actual function definition (which just returns the default `Single`). RE: Problem with one function - SMcNeill - 08-29-2023 Function punktKomma$ (dEingabe As Double) <<-- All fixed. See the $ there? Matt musta beat me by seconds! RE: Problem with one function - Kernelpanic - 08-29-2023 Aaaah. . . with strings. I know it, and I forgot it. That was it! Many thanks! |