Replies: 1 comment
-
Hello @widmung89 the reason is tuples are not proper types in Solidity, they can only be used to form syntactic groupings of expressions. So as you can see the function Regarding to the dot notation, you actually are just asking for functions and nothing more: I hope this info might help. Best regards, Cromewar. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi sorry, mega noob here, I've never done coding in my life. When using the "latestRoundData" function, I don't understand why we need to enter the entire 5 variables inside the tuple i.e.
When you use "priceFeed.latestRoundData();", isn't it already understood that "latestRoundData" contains all 5 tuple elements? Why can't I write something like "return priceFeed.latestRoundData([uint256 answer]);" or something along that line?
Also, I am confused when the Dot Notation should be used. I see that in the case of Javascript, the "." is used to access the instance variable (elemt) of an object, for example:
let obj = {
cat: 'meow',
dog: 'woof'
};
let sound = obj.cat;
console.log(sound);
// "meow is returned"
But in Solidity, the Dot Notation "." sometimes seems to be used to access elements in an object/struct, and sometimes it seems to be used for executing a function on a state variable, for example:
Hope you can help with my 2 questions! Thank you so much! :D
Beta Was this translation helpful? Give feedback.
All reactions