Void Functions
Void Functions
π¨βπΌ Many functions in real applications don't return valuesβthey perform
actions. These are called side effects, and they return
void.Examples of side effects:
- Logging information
- Updating the UI
- Sending data to a server
- Playing a sound
π¨ Open
and:
- Create a
logInfofunction that logs a message with "[INFO]" prefix - Create a
logErrorfunction that logs with "[ERROR]" prefix - Create a
logWithTimestampfunction that includes the current time
π° Use
Date to get the current time and include it in the log.π° Void functions donβt return a value.


