If, ElseIF and Else operators in VB

How to make a computer to vary its responses depending on different users. Still a simple code but it is more and more interesting.Console.WriteLine("Good morning!")


       Console.ReadLine()
       Console.WriteLine("What is your name?")
       Dim userName As String = Console.ReadLine()

       Console.WriteLine("How are you today, " & userName & "?")
       Console.ReadLine()
       If userName = "Jola" Then
           Console.WriteLine("Please enter your password, Jola")
           Console.ReadLine()
       ElseIf userName = "Ignacy" Then
           Console.WriteLine("Welcome Ignacy.")
       Else
           Console.WriteLine("Pleased to meet you, " & userName & "!")
           Console.ReadLine()
       End If
       Console.ReadLine()

Very basic calculator

     For the time being it can only do one operation – here it multiplies two numbers.

    Console.WriteLine("Please enter the first number")
     Dim num1 As Double = Console.ReadLine()
     Console.WriteLine("First number: " & num1)
     Console.WriteLine("Please enter the second number")

     Dim num2 As Double = Console.ReadLine()
     Console.WriteLine("Second number: " & num2)

     Console.WriteLine("The numbers multiplied is: " & num1 * num2)
     Console.ReadLine()

How to get an input from a potential user of our code

I did manage to do it workable, only – even thought that the second part of the sentences which should be written on the screen is red and there is no errors – I cannot see it on the computer screen. Well, I will work on it when I learn how to do it.

       Dim userName As String = Nothing
       Dim userBook As Integer = Nothing
       Dim userTime As Double = Nothing
       Console.WriteLine("What is your name?")
       userName = Console.ReadLine()
       Console.WriteLine("How many books do you read per month?")
       userBook = Console.ReadLine()
       Console.WriteLine("How much time a day do you spend chatting on skype?")
       userTime = Console.ReadLine()
       Console.Write("Your name is: " & userName)
       Console.Write(" You read: " & userBook &  " books per month.")
       Console.Write("  You spend: " & userTime & " hours chatting on skype daily.")
       Console.WriteLine()
       Console.ReadLine()

There is very easy trick to get the second part of a literal string visible, we have to repeat the sign 'AND', and that is all.

Simple code to talk with numbers

Numbers from 1 to 10 times 13 (x = a * 13) where a can be any number from 1 to 10. In fact this kind of numbers are called integers (like: –9, 4, 9). Do not remember if 0 is an integer but probably yes, and the whole numbers are all number with are not 0 and not minus. Other numbers are called decimals or fractions.

There is a commend : Double in VB but not sure for what yet.

Module Module1
 
    Sub Main()

For index = 1 To 10
           Console.WriteLine(index * 13)
       Next
       Console.ReadLine()

End Sub

End Module

A few new words used in programing:

  1. concatenate
  2. operand
  3. truncate

A little bit of programming - Hello World

I started to learn VB and Python at the same time, and found it difficult to remember codes and meanings. As I am learning by watching videos and trying to do the same in programs I decided to keep some knowledge online, instead of looking for a video or for a file with code. So here I will keep some first codes to remember  and repeat it.

My first code in which I learnt how to tell the application to show a string (opposite to valuables, meaning digits).

Module Module1

    Sub Main()
        Console.WriteLine("Hello World!")
        Console.ReadLine()
    End Sub

End Module

 

And a little bit of a conversation with a computer, maybe at some point I will learn how to give different answers, depending on using some key words like: nice, fine, wonderful or bad. Smile

 

Module Module1

    Sub Main()
        Console.WriteLine("Hello World!")
        Console.ReadLine()
        Console.WriteLine("How are you today?")
        Console.ReadLine()
        Console.WriteLine("Anyway, have a wonderful day!")
        Console.ReadLine()

    End Sub

End Module

Cathy Kelly - What she wants

Some vocabulary from the second chapter of the book, I would try to post some of them from the first chapter and write anything about the book. Anyway, I have enjoyed reading it.

  • incumbent noun [C]
the person who has or had a particular official position:
the first/last/previous incumbent
The present incumbent (of the post) is due to retire next month.

  • kudos noun [U]
the fame and public admiration that a person receives as a result of a particular achievement or position in society:
Being an actor has a certain amount of kudos attached to it.

  • muster sth up phrasal verb
If you muster up a feeling of bravery or energy, you try hard to find that quality in yourself because you need it in order to do something:
[+ to infinitive] She finally mustered up the courage to ask him for more money.

  • teeter on the brink/edge of sth
If something is teetering on the brink/edge of a bad situation, it is likely that the situation will happen soon:
What we are seeing now is a country teetering on the brink of civil war.
teetering on the abyss of the forty

  • bleached an adjective
- having lost freshness or brilliance of color; "sun-bleached deck chairs"; "faded jeans"; "a very pale washed-out blue"; "washy colors"
faded, washed-out, washy
colorless, colourless - weak in color; not colorful

  • slog (WORK HARD) verb -gg-
1 [I usually + adverb or preposition] MAINLY UK INFORMAL to work hard over a long period, especially doing work that is difficult or boring:
I've been slogging away for days on this essay and I'm still not finished.
2 [I + adverb or preposition] to travel or move with difficulty, for example through wet, sticky soil or snow, or when you are very tired:
Despite the rain, they slogged on for another six miles.

  • dork noun [C] SLANG
a stupid awkward person

  • mainline (DRUGS) verb [I or T] INFORMAL
to inject drugs directly into the blood:
Several of her friends were mainlining heroin.
By now she was mainlining.

  • tawny adjective
of a light yellowish brown colour, like that of a lion

  • sleek adjective
(especially of hair, clothes or shapes) smooth, shiny and lying close to the body, and therefore looking well cared for; not untidy and with no parts sticking out:
The cat had sleek fur.
Who owns that sleek black car parked outside your house?
DISAPPROVING He's one of those sleek (= seeming rich and dishonest) businessman types.

  • willowy adjective APPROVING
(especially of a woman) graceful and thin:
a willowy blonde

  • with a vengeance
with great force or extreme energy:
He's been working with a vengeance over the past few weeks to make up for lost time.
Flared trousers are back with a vengeance (= very popular again) this summer.

  • fall by the wayside
If someone falls by the wayside, they fail to finish an activity, and if something falls by the wayside, people stop doing it, making it, or using it :
So why does one company survive a recession while its competitors fall by the wayside?

  • reedy adjective
2 DISAPPROVING describes a sound, especially a voice, that is thin and high and not pleasant to listen to

Law and order vocabulary

a search warrant
a rebuttal witness
litigation
on a technicality
indigent
to be implicated in
treason
to commit treason, high treason

About this blog


Pages

Powered by Blogger.

Popular Posts

About Me

Blogger templates

Blogroll

Blog Archive

Blogger templates

Blogger news