Question

I'm unable to figure out what it wrong with this

Func Hypotenuse($a, $b)
    Return sqrt($a * $a + $b * $b)
EndFunc

Error is

Func Hypotenuse($a, $b)
Func Hypotenuse($a, $b)^ERROR

Error: Illegal text at end of statement (one statement per line).

EDIT: It appears to have been a hidden character

Was it helpful?

Solution 2

You copied code from AutoIt forum or some other Invision Power Board driven forum.

If that is correct, you copy the end-of-line HTML-character if you don't pop out the code box. Easiest fix for many lines is to CTRL + A, copy & paste into Notepad, then copy that and paste back into SciTE.

OTHER TIPS

Well, nothings wrong there :O

This:

Func Hypotenuse($a, $b)
    Return sqrt($a * $a + $b * $b)
EndFunc


ConsoleWrite(Hypotenuse(2,2))

Works perfect for me? And for you? Whats the rest of the Code?

This sort of thing can happen when you call your function from the incorrect If..Then statement. For example, the code

If Hypotenuse(1,1) > 0 Then ConsoleWrite("test" & @CRLF) EndIf

gives you an "Illegal text at end of statement" error, whereas the code

If Hypotenuse(1,1) > 0 Then ConsoleWrite("test" & @CRLF)

or

If Hypotenuse(1,1) > 0 Then
   ConsoleWrite("test" & @CRLF)
EndIf

works just fine.

I had the same issue when I had an extra ) at the end of the call.

Real code issue:

LogProgram("(SM) Selected Image SM: " & $imageList[$smPicName]))  

Correct:

LogProgram("(SM) Selected Image SM: " & $imageList[$smPicName])
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top