Reputation: 1461
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
Upvotes: 0
Views: 1719
Reputation: 134
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.
Upvotes: 1
Reputation: 1
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])
Upvotes: -1
Reputation: 19
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.
Upvotes: -1
Reputation: 338
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?
Upvotes: 2