Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: objects having member functions #38

Merged
merged 1 commit into from
Feb 8, 2024
Merged

Conversation

pacifiquem
Copy link
Member

We have a way a function can have a member function.

porogaramu_ntoya add(a, b) {
    tanga a + b
}

reka obj = {
    addNumbers: add
}   

tangaza_amakuru(obj.addNumbers(1, 2)) // this will print 3 to the screen

Even though we can declare a function inside an object declaration, we're able to label a function with a key in an object and the function can be called from there.

@pacifiquem pacifiquem merged commit 179b4be into main Feb 8, 2024
3 checks passed
@pacifiquem pacifiquem deleted the obj-member-function branch February 8, 2024 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant