WeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeBasic

From Esolang
Jump to navigation Jump to search

WeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeBasic (or WeeB) is a derivative of Weeeeeeeeeeeeeeeeeeeeeeeeeeeeee created by User:None1, which is Weeeeeeeeeeeeeeeeeeeeeeeeeeeeee with some additional syntax.

Syntax

The language is designed to be like BASIC and Weeeeeeeeeeeeeeeeeeeeeeeeeeeeee, and all the commands in Weeeeeeeeeeeeeeeeeeeeeeeeeeeeee is still usable in this language, and the meanings of these commands are not changed (except Start epidemic and Delevop vaccine and Skip next if no one infected).

Except the syntax in Weeeeeeeeeeeeeeeeeeeeeeeeeeeeee, WeeB also has some additional syntax, including if, if else, print, input, and do while. Overflow and underflow wraps around.

WeeB is not case sensitive.

WARNING: All spaces in this section are mandatory, that is:

Print"123"

Will not work!

Note:Unlike Weeeeeeeeeeeeeeeeeeeeeeeeeeeeee, in WeeB, Start epidemic and Delevop vaccine are NOPs and lines that start with one of them are comments. Also, Skip next if no one infected in removed because it is a stupid way of conditional.

If statement

If Number Of Infections [Conditional operator] [Number] Then
CODE
End If

Note that the conditional operator and number are MANDATORY, and the conditional operator can be =, <>, <, or >

If else statement

If Number Of Infections [Conditional operator] [Number] Then
CODE1
Else
CODE2
End If

Do while loop

Do
CODE
Loop While Number Of Infections [Conditional operator] [Number]

or

Do
CODE
Loop

Print

Print "STRING"

A shortcut for printing a string.

Print

Print the number of infections as a decimal integer.

Input

Input

Read the number of infections as a decimal integer.

While loop

While Number Of Infections [Conditional operator] [Number]
CODE
End While

Assignment

Reinfect [Number] persons

Change the number of infections to [Number].

End if can be replaced with End while and End while can be replaced with End if (This is no longer true in WBC-v2.0).

Example Programs

Truth Machine

bulk infect
If number of Infections <> 48 Then
do
check number of Infections
Loop
Else
check Number of Infections
end If

Alternative

Input
If number of Infections = 0 Then
Print
Else
do
Print
Loop
end If

Hello World

Print "Hello World!"

Cat Program (with comments)

Do
bulk infect
Check number of infections
loop while number of infections <> 10
Start epidemic (This is a comment)
Delevop vaccine (It only echoes one line of input)

Cat Program (without comments)

Do
bulk infect
Check number of infections
loop while number of infections <> 10

Cat Program (forever)

Do
bulk infect
Check number of infections
loop

Age comparer

Print "How old are you?"
Input
If Number of infections > 18 Then
Print "You are above 18."
End if
If Number of infections < 18 Then
Print "You are below 18."
End if
If Number of infections = 18 Then
Print "You are 18."
End if

Number guessing game

Print "I thought of a number from 1-100. Do you know what is it? "
While number of infections <> 42
Input
If number of infections > 42 then
Print "Too large! Guess again. "
End if
If number of infections < 42 then
Print "Too small! Guess again. "
End if
End while
Print "That's right!"

99 bottles of beer

Because the Print command cannot print multiline strings, this code doesn't output any line feeds. But since WBC automatically adds a space to decimal outputs, it prints the spaces after the numbers.

Reinfect 99 persons
While number of infections > 0
Print
If number of infections <> 1 then
Print "bottles of beer on the wall. "
Print
Print "bottles of beer. Take one down and pass it around. "
Else
Print "bottle of beer on the wall. "
Print
Print "bottle of beer. Take one down and pass it around, "
End If
Deinfect person
If number of infections <> 0 then
Print
else
Print "no "
End If
If number of infections <> 1 then
Print "bottles of beer on the wall. "
Else
Print "bottle of beer on the wall. "
End If
End While
Print "No bottles of beer on the wall, no bottles of beer. Go to the store and buy some more, 99 bottles of beer on the wall."

External resources

  • WBC, the transpiler from WeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeBasic/WeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeBasic++ to C.
  • Online IDE

See also