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:
Now, if your if is false, nothing is going to show up. So we can add else.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") }
Else, unlike if, doesn't need a value, so it just looks like:
Now there will always be something showing up on your page.Code:else { document.write("The value was wrong") }
If you want more than one value you can simply add more else:
So you could have a full code like:Code:else(s+7=9) { document.write("This is the extra else example") }
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
Sorry, I use a Wii. I don't have a computer yet so I can't upload, download, or take screenshots.
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
Thanks. I'm going to make another one sometime, but for now I want to add on to this one.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks