Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
Sign in to follow this  
formlesstree4

Lesson 3 - If/Then Statements

Recommended Posts

[Haven't posted something here in ages...]

I have a corresponding video tutorial on Youtube for those who are better at learning visually and hearing someone talk.

 

Now, to the lesson.

 

The If/Then statement is for logic support. You use them to check for something to be true/false/whatever you want.

For example:

Dim y as String = "String!"
If y = "String!" then
     Msgbox("It's a string!")
End If

 

That is a VERY basic idea of an If/Then statement. If this is that, then do this, else do this. That's how it would be described in English. The video explains this better than I can in text because If/Then statements require a certain level of logical flow to make them work correctly. The ultimate goal is to use If/Then statements to execute certain things only at certain times.

 

There's not much else I can teach you about them, so please watch the video instead. That's what I'll be doing from now on, is releasing tutorial videos for you to watch.

If you have any questions, just post here.

 

Also, as we get more advanced in Visual Basic .NET, I'll show you a little trick that can make something like this easily fixed:

Dim x As Integer = 0
If X = 1 Then
     'do this
End If
If X = 2 Then
      'do this
End If
If X = 0 Then
      'do this
End If

This is really messy, but for what you know, it will get the job done. I'll come back later in Lesson 4 and show you how you can simplify this to something easier for you to understand.

 

Until next time!

formlesstree4

Share this post


Link to post
Share on other sites

This reminds me of DarkBasic, in a way. You ever used that? Great to see you back, man. Nice tutorial :D .

Share this post


Link to post
Share on other sites

Nice tutorial man! a few days ago, without any lesson on how to do it, I made a message box pop up when you clicked a button, ONLY if a certain check box was checked. ;)

 

I am so awesome..

Share this post


Link to post
Share on other sites

Nice tutorial man! a few days ago, without any lesson on how to do it, I made a message box pop up when you clicked a button, ONLY if a certain check box was checked. ;)

 

I am so awesome..

haha, good job. Just don't get a big head when programming, else when something doesn't work you'll get frustrated easily and then give up. Been down that path before, learned the hard way.

Share this post


Link to post
Share on other sites

;P

 

 

Yeah I was just playing.

 

I've been watching and reading your tutorials over and over again, and it is really helping. :L

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...