Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Default (computer science)
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==In computer languages== {{anchor|Default parameter}}Many languages in the [[C (programming language)|C]] family (but not C itself, as of [[C11 (C standard revision)|C11]]) allow a function to have ''default'' parameters or [[default argument]]s, that are used if the function is called with omitted parameter specifications. In C and programming languages based on its syntax, the <code>switch</code> statement (which dispatches among a number of alternatives) can make use of the <code>default</code> keyword to provide a case for when no other case matches. In [[Fortran]], the INIT parameter on a declaration defines an initial default value for that variable. In [[Rust (programming language)|Rust]], [[Data type|types]] that implement the <code>Default</code> [[Trait_(computer_programming)#Rust|trait]] can produce a default [[Value (computer science)|value]].<ref>{{cite web |title=Default in std::default - Rust |url=https://doc.rust-lang.org/std/default/trait.Default.html |website=The Rust Standard Library |access-date=10 April 2022}}</ref> For example, the [[Primitive data type|primitive]] integer types in Rust implement the <code>Default</code> trait by returning 0.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)