Function_names_and_labels.bas
BazzBasic solution for Rosetta Code task.
' ============================================
' https://rosettacode.org/wiki/Scope/Function_names_and_labels
' BazzBasic: https://github.com/EkBass/BazzBasic
' ============================================
' Functions are visible as soon as they are entered
DEF FN MyFunction$(param$) ' auto-declares param$ for MyFunction$
LET MyLocalVar$ = "Hello" ' Just for local use
PRINT param$
RETURN MyLocalVar$
END DEF
' Labels are important part to structure your code,
' even when there is no need to jump around.
' They bring clarity
[inits]
LET varA$ = "[sub:jumpMe]" ' Variables not visible to functions by default
LET CONST_A# = "[sub:jumpMe]" ' Constants are visible everywhere in program
[main]
PRINT "Inside [main]"
PRINT "Calling MyFunction with param 'Foo'"
PRINT FN MyFunction$("Foo")
GOSUB varA$ ' CONST_A# would work too here
END
[sub:jumpMe]
PRINT "Inside " ; varA$ ' Variables visible here, inside of main program
RETURN
' Output:
' Inside [main]
' Calling MyFunction with param 'Foo'
' Foo
' Hello
' Inside [sub:jumpMe]
3D_glowing_orbs.bas
Simple, a BASIC like graphics.
' Glowing orb's
' Stupid neat 3D closing balls effect
' BazzBasic version 1.3
' https://ekbass.github.io/BazzBasic/
[inits]
LET SCREEN_W# = 1280
LET SCREEN_H# = 1024
SCREEN 0, SCREEN_W#, SCREEN_H#, "Glowing Orbs"
LET x$ = 0
LET y$ = 0
LET r$ = 0
LET s$ = 0
LET m$ = 0
LET col$ = 0
[main]
WHILE INKEY <> KEY_ESC#
x$ = RND(SCREEN_W#)
y$ = RND(SCREEN_H#)
r$ = RND(48) + 32
s$ = r$ / 15
SCREENLOCK ON
FOR m$ = 1 TO 15
col$ = RGB(16 * m$, 14 * m$, 12 * m$)
CIRCLE (x$, y$), r$, col$, 1
r$ = r$ - s$
NEXT
SCREENLOCK OFF
SLEEP 16
WEND
END
Anthropic_Claude_API_call.bas
Shall we call Claude?
' ============================================
' Anthropic Claude API call — BazzBasic
' https://github.com/EkBass/BazzBasic
' Public domain
' ============================================
' Requires .env file in same directory as script:
' ANTHROPIC_API_KEY=sk-ant-yourKeyHere
' ============================================
' DISCLAIMER:
' This code was last verified on 04.04.2026 using claude-sonnet-4-20250514.
' AI providers change their APIs, model names and headers over time,
' so this example may stop working without any change in BazzBasic.
'
' If it fails, check the provider's current API documentation first.
' Provider-specific settings are grouped at the top of this file.
' You can also give this file together with the BazzBasic SKILL.md
' to an AI of your choice and ask it to update the code.
'
' https://huggingface.co/datasets/EkBass/BazzBasic-SKILL
[check:env]
IF FileExists(".env") = 0 THEN
PRINT "Error: .env file not found."
END
END IF
[inits]
DIM env$
env$ = FileRead(".env")
LET ApiKey# = env$("ANTHROPIC_API_KEY")
DIM headers$
headers$("x-api-key") = ApiKey#
headers$("anthropic-version") = "2023-06-01"
headers$("Content-Type") = "application/json"
DIM body$
body$("model") = "claude-sonnet-4-20250514"
body$("max_tokens") = 100
body$("messages,0,role") = "user"
body$("messages,0,content") = "Hello"
DIM result$
LET jsonBody$ = ""
LET raw$ = ""
LET count$ = 0
[main]
jsonBody$ = ASJSON(body$)
raw$ = HTTPPOST("https://api.anthropic.com/v1/messages", jsonBody$, headers$)
count$ = ASARRAY(result$, raw$)
PRINT result$("content,0,text")
END
Hundreds of code examples and Rosetta Code solutions here.