BS Import & Export
Learn how to share code across files with import and export in BornomalaScript.
Import and Export
Import and export let you share values between files.
That makes it easier to organize your code into smaller pieces without losing access to important data or functions.
Why Import and Export Matter
They help you:
- split large programs into smaller files
- reuse code in different places
- keep files focused on one job
Basic Idea
One file exports a value.
Another file imports that value and uses it.
Example
test.bs
dhoro value = 5
diyeDao value // this is used for exporting
app.bs
niyeAsho value "test" theke // this is used for importing from a bs module
lekho(value) // this will print 5
How It Works
The export file makes the value available.
The import file brings the value into the current scope so it can be used like any other variable.
Why This Is Useful
Import and export are essential when your project grows beyond a single file.
They help you organize code for:
- utilities
- shared constants
- helper functions
- reusable objects and arrays
Common Mistakes
Beginners often make these mistakes:
- exporting the wrong value
- importing from the wrong file
- forgetting the exact module name
- mixing up what should be imported and what should stay local
Practice Task
Try planning a small project with two files:
- one file exports a value or function
- the other file imports and uses it
Quick Checklist
Before moving on, make sure you can:
- explain why import/export are useful
- identify which file exports and which file imports
- understand how code sharing helps larger projects
If yes, you understand the basics of importing and exporting in BornomalaScript.