Results 1 to 2 of 2

Thread: if -elif-else statement not working

  1. #1
    Join Date
    Nov 2011
    Posts
    4

    if -elif-else statement not working

    Good day everyone, I need to print data using if-elif statement. I when I run this code like this, everything went well

    Code:
        if row['username'] == 'mutago':
            
            print " okay"
            sys.exit(0)
     else:
         print "wrong"
    OKAY now i want to include elseif statement to print another data but it returns error. below is the error code
    Code:
        if row['username'] == 'mutago':
            
            print " okay"
            sys.exit(0)
    elif row['password']=='muta55':
    print "good"
     else:
         print "wrong"
    i have tried also elseif but does not work

  2. #2
    Join Date
    May 2011
    Posts
    428

    Re: if -elif-else statement not working

    Just put sys.exit(0) after (print "good") and then execute the program. See if this get executed properly or not.

Similar Threads

  1. How to use Else and Else If Statement in PHP?
    By Orton in forum Software Development
    Replies: 5
    Last Post: 05-03-2010, 06:49 AM
  2. How to use If statement in PHP?
    By Deabelos in forum Software Development
    Replies: 4
    Last Post: 09-02-2010, 06:14 AM
  3. If Statement in HTML
    By Beatrisa in forum Software Development
    Replies: 3
    Last Post: 07-08-2009, 02:33 PM
  4. Replies: 4
    Last Post: 25-02-2009, 08:52 PM
  5. Powershell using if statement with not?
    By Ekavir in forum Operating Systems
    Replies: 3
    Last Post: 17-02-2009, 09:47 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,550,242.44429 seconds with 16 queries