👋 Hey developers! Today I want to share something useful about Uniface 10.4 and specifically the done statement in ProcScript. This might seem like a small feature, but understanding it properly can make your code cleaner and more predictable.
🤔 What is the done\ Statement?
The done statement in Uniface ProcScript is your clean exit door 🚪. It immediately exits from the current ProcScript module without changing the $status variable. Think of it as a "neutral exit" - you're leaving, but you're not making any statements about success or failure.
🔧 Key Characteristics
- Return Values: None - it doesn't affect
$status - Usage: Allowed in all component types
- Behavior: Immediate exit from ProcScript module
💡 When to Use done\ vs return\
Here's the key difference that many developers miss:
- 🔄 Use
donewhen you want to exit without returning a value - 📤 Use
returnwhen you want to exit with a specific value
📋 Practical Example
Let's look at a real-world scenario from a quit trigger:
trigger quit
if ($formmod = 0)
done
else
message "Data modified!! Use STORE before QUIT."
return (-1)
endif
end; quit
🎯 In this example:
- If no modifications were made (
$formmod = 0), we simply exit withdone - If there are modifications, we warn the user and return
-1to indicate an error state
🎉 Why This Matters
Using done appropriately helps you:
- ✅ Write cleaner, more intentional code
- 🛡️ Maintain proper status handling
- 🎯 Make your exit intentions explicit
💭 This post was created with the help of AI and is based on the official Uniface 10.4 documentation. Hope it helps fellow Uniface developers write better ProcScript code!
Happy coding! 🚀
Top comments (0)