1.17

JavaScript and VBScript.

request

match (data have to be stored in either a file or an array)

file can store a lot of data. Array is part of the program. Not a lot of data, so it is faster. Any change, you have to change the program.

respond  If the match succeeds, it will respond. If not succeed.

and loop

VB uses parenthesis for array in contrast to bracket [ ] in other language.

if statement is the same

loop is almost the same, you don't have all together.

Array and loop comes together.\

 

The search program:

Dim result As Integer = 0

Dim searchword As String

Dim i As Integer

Dim english() = {"water", "book", "house", "car", "university", "computer"}

Dim spanish() = {"aqua", "libro", "casa", "caro", "universidad", "computador"}

searchword = InputBox("Enter English World to Translate")

While searchword <> ""

For i = 0 To 5

If searchword = english(i) Then

MsgBox(" Spanish world is " & spanish(i))

result = 1

End If

Next i

If (result = 0) Then

MsgBox("sorry, No match for " & searchword)

End If

searchword = InputBox("Enter English World to Translate")

End While

 

Hosted by www.Geocities.ws

1