HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Return + If/Then/Else

02-19-2007, 08:44 AM#1
Chocobo
Collapse JASS:
function ReturnDamage takes integer i returns real
    if i==1 then return 185.0
    elseif i==2 then return 340.0 else
    return 630.0
    endif
endfunction

I tryed to do that, but in WE, it gave me :

-Waiting for end line (line 2)
-Waiting for endif (line 3)
-Waiting for endif (line 4)
-Type incorrect for the mentioned indicator (line 7, that line doesn't exist, there's no space in)

Is that normal?
02-19-2007, 08:48 AM#2
Captain Griffen
Stuff needs to be on a new line after the end of then or of a function. This isn't C.
02-19-2007, 09:43 AM#3
Pyrogasm
Quote:
Originally Posted by Captain Griffen
Stuff needs to be on a new line after the end of then or of a function. This isn't C.
Translation: Make it look like this
Collapse JASS:
function ReturnDamage takes integer i returns real
    if i==1 then
        return 185.0
    elseif i==2 then
        return 340.0
    else
        return 630.0
    endif
endfunction
02-19-2007, 03:03 PM#4
WNxCryptic
lol...

Whitespace counts in JASS!
02-19-2007, 09:21 PM#5
shadow1500
Not whitespace, but newline. Each statement must be on it's own line.
02-19-2007, 09:36 PM#6
Alevice
this could be solved by a statement delimiter, like ; !!!!!!!!