Jump to content

Common Operations

From Wikibooks, open books for an open world


Input And Output

[edit | edit source]
Language General Usage Example Usage
Pseudocode
INPUT <Identifier>
Input Answer
Input Age
Input DistanceTravelled
VB.NET
<Identifier> = Console.Readline()

Dim <Identifier> As <Data Type> = Console.ReadLine()
Answer = Console.ReadLine()
Dim Age As Integer = Console.ReadLine()
DistanceTravelled = Console.ReadLine()

Arithmetic, Relational and Logic Operators

[edit | edit source]
Language Arithmetic Operators Integer Division Relational Operators Logic Operators
Addition Subtraction Multiplication Division Modulus Division Greater Than Less Than Greater Than or Equal to Less Than or Equal to Equal To Not Equal To AND OR NOT
Pseudocode + - * / MOD DIV > < >= <= = <> AND OR NOT
VB.NET + - * / MOD \ > < >= <= = <> AND OR NOT

String Operators

[edit | edit source]
Language General Usage Example Usage
Pseudocode
VB.NET

Random Number Generation

[edit | edit source]
Language General Usage Example Usage
Pseudocode
RANDOMBETWEEN(<Minimum>, <Maximum>)
Generates a random INTEGER between the Minimum and Maximum.
RND()
Generates a random REAL number between 0 and 1.
DECLARE Random : INTEGER
Random = RANDOMBETWEEN(10, 17)

DECLARE Random : REAL
Random = RND()
VB.NET
<Variable> = <Minimum> + Rnd() * (<Maximum> - <Minimum>)
Generates a random INTEGER between the Minimum and Maximum.
Rnd()
Generates a random REAL number between 0 and 1.
Dim Random As Integer
Random = RANDOMBETWEEN(10, 17)
Random = 10 + Rnd() * (17 - 10)

Dim Random As Double
Random = Rnd()