Leftover Halloween Candy and Pumpkins: What to Do Next
Sort leftover Halloween candy safely, share or repurpose sealed treats, and choose food use or compost for pumpkins based on their condition.
In Golang , a function is a group of statements used to perform tasks, with an optional return value . Go supports two main ways to pass arguments: Pass by value and Pass by reference. Go uses pass by value by default.

Basic terms in passing parameters to functions:
For example
package main
import "fmt"
// Cố gắng sửa đổi giá trị của num
func modify(num int) {
num = 50
}
func main() {
num := 20
fmt.Printf("Before, num = %d\n", num)
modify(num)
fmt.Printf("After, num = %d\n", num)
}
In this example, numremains unchanged after the call modifybecause it is passed by value.
Syntax
func functionName(param Type) {
// function body # Gọi theo giá trị
}
func functionName(param *Type) {
// function body # Gọi theo tham chiếu
}
In call-by-value, a copy of the actual parameter value is passed. Changes made in the function do not affect the original variable.
Syntax
func functionName(param Type) {
// function body
}
For example:
package main
import "fmt"
// Chỉnh sửa giá trị của num
func modify(num int) {
num = 50
}
func main() {
num := 20
fmt.Printf("Before, num = %d\n", num)
modify(num)
fmt.Printf("After, num = %d\n", num)
}
Result:
Before, num = 20
After, num = 20
The value remains the same, as changes inside modifydo not affect numthe outside main.
Function arguments in Golang
In call-by-reference, a pointer to the actual parameter is passed, so any changes inside the function are reflected on the original variable.
Syntax
func functionName(param *Type) {
// function body
}
For example:
package main
import "fmt"
// Chỉnh sửa giá trị của num qua tham chiếu
func modify(num *int) {
*num = 50
}
func main() {
num := 20
fmt.Printf("Before, num = %d\n", num)
modify(&num)
fmt.Printf("After, num = %d\n", num)
}
Result
Before, num = 20
After, num = 50
Since numit is passed by reference, the command modifywill change its value, which is reflected in the command main.
Sort leftover Halloween candy safely, share or repurpose sealed treats, and choose food use or compost for pumpkins based on their condition.
Compare workplace Halloween costume choices by respect, dress code, mobility, and safety—and learn when a subtle accessory or a policy check is the better option.
Find a couples costume that fits your style, budget, and comfort level, from Addams Family classics to original inside-joke duos.
Need a last-minute high school Halloween costume? Compare 10 easy closet-based ideas by prep time, comfort, school-day practicality, and simple safety checks.
Use a simple 2026 Halloween decorating timeline for indoor décor, outdoor displays, and fresh pumpkins, with practical adjustments for weather and events.
Mix five vivid, approachable Halloween cocktails with measured recipes, simple prep tips, and an alcohol-free option for your party guests.
Find 15 office-friendly Halloween costume ideas for 2026, with practical checks for dress codes, respectful themes, comfort, and workplace safety.
Plan a fun elementary school Halloween party with easy crafts, games, inclusive treats, costume tips, and a sample 75-minute classroom schedule.
Compare realistic side hustles for 2026 by startup cost, fees, flexibility, and income control, with current tax and scam guidance from official sources.
Upgrade your home office ergonomics with current OSHA and NIOSH guidance on chair fit, monitor height, laptop setup, lighting, and movement.