#Include Int Main (Void) (Puts ("Hello World.") )

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

#include <stdio.

h>
int main(void)
{
puts("hello world.");
}




>>> x =

>>> y =

>>> x + y
TypeError: unsupported operand
type(s) for +: car and fruit

#include <iostream>

int main()
{
car x = ;

fruit y = ;

std::cout << x + y << '\n';


}

In function 'int main()':


error: no match for 'operator+' (operand types are 'car' and
'fruit')
Dim x As Car
Dim y As Fruit

Set x =

Set y =

Debug.Print x + y

Type What I t I s Exampl e / Li teral


Long 721734
Double -17.56

String "hello world"

Boolean True
Variant any of the above
Option Explicit

Public Sub WriteCell(ByVal cell As Range, ByVal contents


As Variant)
cell.Value = contents
End Sub

Public Function Factorial(ByVal x As Long) As Long


If x <= 0 Then
Factorial = 1
Else
Factorial = x * Factorial(x - 1)
End If
End Function

Public Sub UseFunctions()


Debug.Print "original value: " &
ActiveSheet.Range("A1").Value
WriteCell ActiveSheet.Range("A1"), 17
Debug.Print "new contents: " &
ActiveSheet.Range("A1").Value
Debug.Print "factorial(5) = " &
Factorial(5)
End Sub

original value:
new contents: 17
factorial(5) = 120
[Public|Private] Function
Name([ByVal|ByRef] Arg1 [As Type], )
As Type

Name = value
End Function

result = Name(arg1, )

[Public|Private] Sub
Name([ByVal|ByRef] Arg1 [As Type], )

End Sub

Name arg1,

If Condition Then

[Else If OtherCondition Then]

[Else]

End If
Dim i As Long
For i = 1 To 10

Next i

Do [While|Until] Condition

Loop

Do

Loop [While|Until] Condition


Program text
Program, compiler, or interpreter
output

You might also like