Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Codecademy-Programmers Please Help!

  • 28-07-2012 2:51pm
    #1
    Registered Users, Registered Users 2 Posts: 627 ✭✭✭


    Hi all you programmers out there, please help me! im stuck on this problem on codecademy and cant find a solution? If you could help me id really appreciate it!
    Cheers


Comments

  • Registered Users, Registered Users 2 Posts: 15,065 ✭✭✭✭Malice


    What have you tried so far? Post your code and it'll be easier to see where you're going wrong.


  • Moderators, Computer Games Moderators Posts: 10,462 Mod ✭✭✭✭Axwell


    for ( var i=99; i<=101; i++ ) 
    
    if (i%2 == 0)
    {
    print("Even!")  
    }
    else
    {
    print("Odd!")
    }
    
    


  • Registered Users, Registered Users 2 Posts: 2,695 ✭✭✭Darwin


    Have you tried the hint button which talks about the modulus (%) operator? I presume you understand how if/else selection works? Here's two things to think about: If the result of (i % 2) is 0, what does that tell you about i? How do you perform an equality test inside an if statement?


  • Registered Users, Registered Users 2 Posts: 627 ✭✭✭kerryked


    hey guys thanks for the really quick responses! Axwell, your answer worked like a charm! what i had was

    for ( var i=99; i<=101; i++ ) {
    if (i%2=0, console.log("Even!))
    else console.log("Odd!")

    as they say, close but no cigar!..ah well..my curly bracket things were all over the place, i dont think i even had any! i also forgot that you have to have like 3 equals signs...

    Anyways cheers for ye're help lads!


Advertisement