π 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
done
when you want to exit without returning a value - π€ Use
return
when 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
-1
to 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)