Releases: BowLang/Bow
Releases · BowLang/Bow
v0.7.1 Improved Switch Statements
Switch statements now properly handle breaks and returns. The calculator example can be modified to:
fun to_dec(num -str-) =dec=>
switch num ==>
"0" ?->
<-- 0
"1" ?->
<-- 1
"2" ?->
<-- 2
"3" ?->
<-- 3
"4" ?->
<-- 4
"5" ?->
<-- 5
"6" ?->
<-- 6
"7" ?->
<-- 7
"8" ?->
<-- 8
"9" ?->
<-- 9
other ?->
<-- -1
<==
<==
fun enter_num =dec=>
str_num <-con str-< input("Enter a number 0-9: ")
dec_num <-con dec-< to_dec(str_num)
if dec_num = -1 ==>
output("Invalid.")
<-- enter_num
<==
<-- dec_num
<==
fun enter_calc =str=>
calc <-con str-< input("Enter calculation (+,-,*,/): ")
if calc != "+" && calc != "-" && calc != "*" && calc != "/" ==>
output("Invalid.")
<-- enter_calc
<==
<-- calc
<==
num_1 <-con dec-< enter_num
calc <-con str-< enter_calc
num_2 <-con dec-< enter_num
result <-var dec-< 0
switch calc ==>
"+" ?->
result <-< num_1 + num_2
break
"-" ?->
result <-< num_1 - num_2
break
"*" ?->
result <-< num_1 * num_2
break
"/" ?->
result <-< num_1 / num_2
break
<==
v0.7.0 Switch Statements
This release adds switch statements to Bow.
Example program (you have to run in debug mode to see final variable value 🤣):
fun to_dec(num -str-) =dec=>
switch num ==>
"0" ?->
<-- 0
break
"1" ?->
<-- 1
break
"2" ?->
<-- 2
break
"3" ?->
<-- 3
break
"4" ?->
<-- 4
break
"5" ?->
<-- 5
break
"6" ?->
<-- 6
break
"7" ?->
<-- 7
break
"8" ?->
<-- 8
break
"9" ?->
<-- 9
break
other ?->
<-- -1
break
<==
<==
fun enter_num =dec=>
str_num <-con str-< input("Enter a number 0-9: ")
dec_num <-con dec-< to_dec(str_num)
if dec_num = -1 ==>
output("Invalid.")
<-- enter_num
<==
<-- dec_num
<==
fun enter_calc =str=>
calc <-con str-< input("Enter calculation (+,-,*,/): ")
if calc != "+" && calc != "-" && calc != "*" && calc != "/" ==>
output("Invalid.")
<-- enter_calc
<==
<-- calc
<==
num_1 <-con dec-< enter_num
calc <-con str-< enter_calc
num_2 <-con dec-< enter_num
result <-var dec-< 0
switch calc ==>
"+" ?->
result <-< num_1 + num_2
break
"-" ?->
result <-< num_1 - num_2
break
"*" ?->
result <-< num_1 * num_2
break
"/" ?->
result <-< num_1 / num_2
break
<==
v0.6.0 Functions
You can now declare and call your own functions and call the 2 current builtin functions: input and output.
v0.5.0 Bracketed Expressions
You can now have bracketed expression in your Bow code. Calculations follow bidmas
v0.4.0 If Statements
You can now do if statements in Bow! The syntax is:
if condition ==>
(stuff)
<== altif condition ==>
(stuff)
<== alt ==>
(stuff)
<==
v0.3.0 Variable Assignment
v0.2.0 Intereactive Shell
v0.1.0
Run Bow files by running the executable with the file path as the first argument.
e.g.
>> ./Bow.exe hello.bow
What's Changed
- ✨ Add declaration of variables by @Coding-Cactus in #1
New Contributors
- @Coding-Cactus made their first contribution in #1
Full Changelog: https://github.com/Coding-Cactus/Bow/commits/v0.1.0