Functions
Function Structure

public
-> visibility declarationview
-> Indicates function behaviorreturns
-> type of variable being returned
// updates message variable. cannot return.
function setMessage(string newMessage) public {
message = newMessage;
}
// synthax will clear. looks correct. but wont work.
function setMessage(string newMessage) public returns (string){
message = newMessage;
return message;
}
You cannot create a function with the same name as a storage variable. Will conflict with getter function.
Last updated