+ Reply to Thread
Results 1 to 5 of 5

Thread: How to use if else

  1. #1
    toxifyshadow's Avatar
    toxifyshadow is offline Programmer
    Join Date
    Mar 2010
    Location
    Oregon
    Posts
    125
    Blog Entries
    5
    Rep Power
    0

    How to use if else

    Using if else can be very helpful.
    Here's basically what it does and how it works.

    First we create the if part.
    If the if is true then the code inside will be executed.
    This looks like:
    Code:
    /*Define if, and give it a value.
    if that value is true than the code will be executed
    */
    if(x+a=y)
    //here is your code to be used
    {
    document.write("This value is true")
    }
    Now, if your if is false, nothing is going to show up. So we can add else.
    Else, unlike if, doesn't need a value, so it just looks like:
    Code:
    else
    {
    document.write("The value was wrong")
    }
    Now there will always be something showing up on your page.
    If you want more than one value you can simply add more else:
    Code:
    else(s+7=9)
    {
    document.write("This is the extra else example")
    }
    So you could have a full code like:
    Code:
    if(x+a=y)
    {
    document.write("Value 1 is true")
    }
    else(x+a<y)
    {
    document.write("Value 2 is true")
    }
    else
    {
    document.write("All values are false")



    This is my first tutorial and I hope you enjoyed this.
    Last edited by toxifyshadow; 03-18-2010 at 07:04 PM. Reason: Added more

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Location
    Advertising world
    Posts
    Many

     
  3. #2
    Join Date
    Nov 2009
    Location
    London
    Posts
    866
    Blog Entries
    3
    Rep Power
    14

    Re: How to use if else

    Do provide screenshots or extend on it a little but not bad tut

  4. #3
    toxifyshadow's Avatar
    toxifyshadow is offline Programmer
    Join Date
    Mar 2010
    Location
    Oregon
    Posts
    125
    Blog Entries
    5
    Rep Power
    0

    Re: How to use if else

    Sorry, I use a Wii. I don't have a computer yet so I can't upload, download, or take screenshots.

  5. #4
    Irfan_A's Avatar
    Irfan_A is offline Programmer
    Join Date
    Dec 2009
    Location
    INA
    Posts
    180
    Blog Entries
    5
    Rep Power
    9

    Re: How to use if else

    Maybe better you make and post tutorial at midnight.
    Keep up good work and add more features like advice from James.
    That is your first tutorial, good, i wait your other tutorials about JavaScript again or others in future.

    (oh, i never post tutorial in CC up to now, i will do it soon if i have enough time...)
    nomainwin : open "CodeCall" for dialog_nf_modal as #whileTrue : wait

  6. #5
    toxifyshadow's Avatar
    toxifyshadow is offline Programmer
    Join Date
    Mar 2010
    Location
    Oregon
    Posts
    125
    Blog Entries
    5
    Rep Power
    0

    Re: How to use if else

    Thanks. I'm going to make another one sometime, but for now I want to add on to this one.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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