Learning Boo
I took up the Boo programming language on 2021 October 31st as a way to celebrate Halloween. The language was so similar to Python that I was able to find minor differences and gain quick mastery in the language. I have used the language before, but not to build an actual program. My first Boo program is the project Halloween assistant
Here is a sample program I made to test the difference between Python and Boo syntax. I don't have a compiler to test this yet, and I hope to split this into several parts.
# Testing out Boos syntax, it is so similar to Python 2
pi = float(3.14)
engineerPi = int(4)
str = string "Hello World"
import random()
int x = random.randint(1, 10)
tuple = int(42) // This is a comment as well
/* Noted differences between Boo and Python 2
str is string
tuples are not supported
Parentheses are not common in strings, I don't know if they are supported
Comments can be in both pound sign, and double backslash/blockquote // /* formats, along with """ but not '''
*/
"""
This is also a comment block
"""
/*
'''
but this isn't, so I had to comment it out
'''
*/
def kwordsSyntaxBoo(): // This function is for testing Boo syntax and should NEVER be called by the program
and if while when else elif for each
end exit quit return
/Command
// Not supported: each, end, exit, quit
class test()
list = ["1", "Apple", "Banana"]
def function1():
print "Hello world\nHi world\tdlrow iH\nGoodbye"
break
def concatenateList():
print "Concatenate List\n" + string(list) + "\nEnd of list"
break
// Main
return test()
return concatenateList()
break
# File info
# File version: 1 (Sunday, 2021 October 31st at 5:50 pm)
# File type: Boo source file (*.boo)
# Line count (including blank lines and compiler line): 57
# End of script
(i) This example may have problems.
/!\ This program has not been tested, and may not compile.
This section was last updated on 2021, Monday, November 1st at 5:47 pm (the time stamp was added at this time)
Similarity to Python 2
I was able to learn Boo very easily due to its similarity with Python 2 (NOT Python 3) here are the differences I noticed in order:
# I was able to learn Boo very easily due to its similarity with Python 2 (NOT Python 3) here are the differences I noticed in order:
print "Strings don't have parentheses."
(i) This example may have problems.
/!\ This program has not been tested, and may not compile.
This section was last updated on 2021, Monday, November 1st at 5:47 pm (the time stamp was added at this time)
Data types
pi = float(3.14)
engineerPi = int(4)
str = string "Hello World"
print "Out of this, the only different keyword is str being string"
break
(i) This example may have problems.
/!\ This program has not been tested, and may not compile.
This section was last updated on 2021, Monday, November 1st at 5:47 pm (the time stamp was added at this time)
Importing and randomization
import random()
int x = random.randint(1, 10)
print (x)
break
(i) This example may have problems.
/!\ This program has not been tested, and may not compile.
This section was last updated on 2021, Monday, November 1st at 5:47 pm (the time stamp was added at this time)
Tuples
Boo does NOT support tuples. The following is a normal integer with no tuple functionality built-in.
tuple = int(42) // This is a comment as well
print (tuple)
(i) This example may have problems.
/!\ This program has not been tested, and may not compile.
This section was last updated on 2021, Monday, November 1st at 5:47 pm (the time stamp was added at this time)
Comments
Boo supports standard Python comments, such as #
and """
but does not support '''
. However, backslash comments are supported, such as //
and /* * */
# This is a comment
// This is also a comment
""" This
is
a
comment
block """
// ''' This is NOT a comment block, so it has been commented out '''
/* But this IS a comment
block
*/
(i) This example may have problems.
/!\ This program has not been tested, and may not compile.
This section was last updated on 2021, Monday, November 1st at 5:47 pm (the time stamp was added at this time)
Functions
The syntax of functions in Boo is identical to that in Python.
def testFunction1():
print "Hello world"
break
testFunction1()
break
(i) This example may have problems.
/!\ This program has not been tested, and may not compile.
This section was last updated on 2021, Monday, November 1st at 5:47 pm (the time stamp was added at this time)
Break
The break keyword is identical in Boo.
print "Break time!"
break
(i) This example may have problems.
/!\ This program has not been tested, and may not compile.
This section was last updated on 2021, Monday, November 1st at 5:47 pm (the time stamp was added at this time)
Classes
Boo supports classes similary to Python.
class myBooClass()
print "Welcome to my boo class!\nI learned Boo on Halloween 2021"
break
(i) This example may have problems.
/!\ This program has not been tested, and may not compile.
This section was last updated on 2021, Monday, November 1st at 5:47 pm (the time stamp was added at this time)
Escape characters
Boo supports escape characters, but some text highlighters highlight them in the way of a language like C or C++. I don't entirely know why.
class escapeBoo()
print "Newline?\nNewline!"
print "Tab?\tTab!"
print "Quotes? \"Quotes!\""
break
(i) This example may have problems.
/!\ This program has not been tested, and may not compile.
This section was last updated on 2021, Monday, November 1st at 5:47 pm (the time stamp was added at this time)
Lists
Boo may support lists similarly to Python.
list = ["1", "Apple", "Banana"]
print (string(list))
break
(i) This example may have problems.
/!\ This program has not been tested, and may not compile.
This section was last updated on 2021, Monday, November 1st at 5:47 pm (the time stamp was added at this time)
Concatenation
Boo supports concatenation similarly to Python.
con1 = string("Con")
cat2 = string("cat")
ena3 = string("ena")
te_4 = string("te!")
print (string(con1) + string(cat2) + string(ena3) + string(te_4))
break
(i) This example may have problems.
/!\ This program has not been tested, and may not compile.
This section was last updated on 2021, Monday, November 1st at 5:47 pm (the time stamp was added at this time)
Return and execute
Boo supports calling functions and returning values similarly to Python.
def funct():
print "Function has returned"
break
return funct()
funct()
break
(i) This example may have problems.
/!\ This program has not been tested, and may not compile.
This section was last updated on 2021, Monday, November 1st at 5:47 pm (the time stamp was added at this time)
This section was last updated on 2021, Monday, November 1st at 5:47 pm (the time stamp was added at this time)
Range
It seems that Boo supports the range
keyword, but I don't have a compiler to test it. This is my written example:
print "Ranges in Boo"
for x in range(1,3):
print (x)
x == x + 1
break
(i) This example may have problems.
/!\ This program has not been tested, and may not compile.
This section was last updated on 2021, Thursday, November 11th at 6:04 pm
I honestly feel like Boo was forked from Python with minor modifications. The 2 languages are so similar.
New knowledge
The following are things I learned about the Boo programming language that are not similar to Python.
This section was last updated on 2021, Monday, November 1st at 5:47 pm (the time stamp was added at this time)
Commands
A single backslash seems to support the execution of commands.
/command1 // This is not solid knowledge, and is subject to change
(i) This example may have problems.
/!\ This program has not been tested, and may not compile.
This section was last updated on 2021, Monday, November 1st at 5:47 pm (the time stamp was added at this time)
File info
Click/tap here to expand/collapse the file info section
File type: Markdown document (*.md *.mkd *.mdown *.markdown)
File version: 2 (2021, Thursday, November 11th at 6:31 pm)
Line count (including blank lines and compiler line): 391
File history
Click/tap here to expand/collapse the file history section
Version 1 (2021, Monday, November 1st at 5:51 pm)
Changes:
- Started the file
- Added the title section
- Added the first 14 examples
- No other changes in version 1
Version 2 (2021, Thursday, November 11th at 6:31 pm)
Changes:
- Added a logo
- Added 1 new example
- Added the file info section
- Added the file history section
- Added the footer
- No other changes in version 2
Version 3 (Coming soon)
Changes:
- Coming soon
- No other changes in version 3
Version 4 (Coming soon)
Changes:
- Coming soon
- No other changes in version 4
You have reached the end of the README file
( Back to top | Exit to GitHub | Exit to Bing | Exit to DuckDuckGo | Exit to Safe.DuckDuckGo.com | Exit to Ecosia | Exit to Swisscows )