GOCO IDE
  • Home
  • Docs
Download

Documentation

Chapter 1: BasicsChapter 2: Variables & TypesChapter 3: Input and OutputChapter 4: Math and OperatorsChapter 5: Making DecisionsChapter 6: Repeating Parts (Loops)Chapter 7: FunctionsChapter 8: Arrays (Lists)Chapter 9: Standard Libraries

7. Reusable Code with Functions

7.1 What is a Function?

A function is a named block of code you can use over and over. You give it an input, and it does the job. Notice that a function must close with '}.' at the end.

Function sayHello(Sentence name) {
Displaynl("Hello there, " + name + "!").
}.
// Using the function
sayHello("Tom").
sayHello("Jerry").

7.2 Getting Answers Back

Some functions do not do actions. They find answers and give them back to you using Return. You have to tell it what kind of box it Returns.

Function getDouble(Number a) {
Return a * 2.
} Returns Number.
Number answer = getDouble(5).
Displaynl(answer).

Contact Us

+91 93269 63378kancorp.inc@outlook.com
📍KanCorp Inc, India

Quick Links

  • Home
  • Docs
  • Download IDE

Stay Updated

Subscribe to get updates on new features and learning resources!

© 2026GOCO IDE™. All rights reserved. Made with ❤️