IF Statement....



  • Hi all,

    I have read almost all the IF statements and come up with this code
    but it allways stops at the first IF while my database contains songs
    with the other Singers in the second If. It seems that the runner stops
    after the first IF. Any help would be very much appreciated.

    There will be more IF statements in this code but it goes wrong already.
    What i want to achieve is that the runner goes trough all the IF's and capture the right one

    This is a example
    IF "<Singers>" MatchesRegex "[ABCD]"
    SET CAP "Limited" "1950-1970 Movie Songs by Language"
    SET STATUS SUCCESS
    ...
    ENDIF

    ELSE
    IF "<Singers>" MatchesRegex "[ABCDEFG]"
    SET CAP "Medium" "1970-1990 Movie Songs by Language"
    SET STATUS SUCCESS
    ...
    ENDIF

    If it finds the first IF only it should stop and go on with the Config and so one...At the last IF it also must further with Config..



  • @Hakka
    You can't start IF statement with ELSE.
    After the first ENDIF you have ELSE, that why your config stop.



  • Thanks @Br4uN for your repley...Most likely i will have 6 IF statement in the config...With wich code i can achive what i want it to do then...Kinda lost in all the already codes in here...

    "If it finds the first IF only it should stop and go on with the Config and so one...At the last IF it also must further with Config.."



  • just delete the ELSE before the IF


  • Admin

    There is no "else if" implementation in loliscript, you have to use a JUMP in order to achieve that, in every IF statement.

    IF ...
    ...
    JUMP #END
    ENDIF
    
    IF ...
    ...
    JUMP #END
    ENDIF
    
    #END
    


  • I'm nor sure if you are aware, but you can use blocks inside IFS normally, without any problem. So, if you want, try this:

    IF "<Singers>" MatchesRegex "[ABCD]"
    #request block
    #function block
    #parse block
    #keycheck block
    ...
    ENDIF
    
    IF "<Singers>" MatchesRegex "[ABCDEFG]"
    #request block
    #function block
    #parse block
    #keycheck block
    ...
    ENDIF
    

    It's just an example so you can understand that you don't need to use only commands like SET with IFs. You can just use "nested" blocks, I don't know the right expression.



  • Thanks Guys for all the info...Really appreciated from a Noob like me...I will test these in the weekend...


Log in to reply