' Simple BASIC Program Example
DIM name AS STRING
DIM age AS INTEGER
DIM score AS DOUBLE
' Get user input
PRINT "Enter your name: "
INPUT name
PRINT "Enter your age: "
INPUT age
' Calculate something
score = age * 1.5 + 10
' Conditional logic
IF age >= 18 THEN
PRINT name & " is an adult"
ELSE
PRINT name & " is a minor"
END IF
' Loop example
FOR i = 1 TO 10
PRINT "Number: " & i
NEXT i
' While loop
counter = 0
WHILE counter < 5
PRINT "Counter: " & counter
counter = counter + 1
WEND
' Subroutine
GOSUB DisplayInfo
END
DisplayInfo:
PRINT "Name: " & name
PRINT "Age: " & age
PRINT "Score: " & score
RETURN
' Function example (VB.NET style)
Function CalculateTotal(price As Double, quantity As Integer) As Double
Dim total As Double
total = price * quantity
If total > 100 Then
total = total * 0.9 ' 10% discount
End If
Return total
End Function