Skip to content

Functions and Events

Differentiate functions and events (Solidity \< 0.4.21)

Favor capitalization and a prefix in front of events (we suggest Log), to prevent the risk of confusion between functions and events. For functions, always start with a lowercase letter, except for the constructor.

// bad
event Transfer() {}
function transfer() {}

// good
event LogTransfer() {}
function transfer() external {}


In v0.4.21 Solidity introduced the emit keyword to indicate an event emit EventName();. As of 0.5.0, it is required.

Back to top