Skip to content

sabtron-coder/sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

JAC Test Application

This is a sample JAC application demonstrating how to separate the main entry point from object definitions.

Structure

  • greeter.jac: Defines the Greeter object.
  • main.jac: Contains the main entry point that imports and uses the Greeter object.

How to Separate Main Entry from Objects

In JAC, you can define objects (classes) in separate files and import them into your main file where the entry point is defined.

Example

Define an object in a separate file (e.g., greeter.jac):

obj Greeter {
    def say_hello(name: str) {
        print(f"Hello, {name}! Welcome to Jac.");
    }
}

In the main file (e.g., main.jac), import the object and use it in the entry block:

import from greeter { Greeter }

with entry {
    let g = Greeter();   # create instance
    g.say_hello("Sabore");
}

This separation promotes modularity and reusability.

About

This is a sample repo

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •