Solidity Basics

Thank you for ur reply.
I did that, while I click on that file, it gives me an empty square, when I want to type something in it, nothing happen (still empty).

Hi @Fahd_Sef

Have you tried to click inside that empty square then type the file name?
You should see something like this:

If that does not work it’s really strange, try to use another browser.

Cheers,
Dani

Yes definitely the same way I tried to type and still not working, that was Safari, I don’t know why doesn’t work, in meanwhile I did try on Google Chrome just now and it is working finally. If u have any idea how to solve it in Safari will be helpful too.
Thx

1 Like

I have the same issue with Safari, never noticed it because I don’t use safari with Remix.
Consider that, in the future you will use metamask, and metamask is not available for Safari therefore you will need to be use Chrome based browsers or Firefox.

Alright got it, that’s really helpful, thank you so much.

1 Like

I do not understan a thing in functions , public means that this function can be called from any part of the contract and pure means that this function will not interact with other part of the contract, this seems to me a little bit counter effect. I mean it is the opposite meaning…

Hey @Jelkucijus

public and pure are two keywords that do not exclude each other.

An example:

pragma solidity 0.7.5;

contract Test {
    
    function sum (uint _a, uint _b) public pure returns (uint) {
        return _a + _b;
    }
}

Let me give you some definitions:

Function visibility:

A function can be public, private, internal , external.

By setting the visibility, you decide who can and cannot call that function.
Documentation about function visibility

Other keywords such as pure do not define the function visibility.
A pure function is a concept common to all programming languages.
A pure function ensures that (the function) does not read read or modify the state and does not have ‘side effects’.
In my example above, the function just sums _a and _b and does not do anything else. That’s the definition of ‘pure’ function.

Happy learning,
Dani

1 Like

Thank you Dani on your effort

1 Like

You’re very welcome!

Great course. I am supplementing each lesson with outside resources. I am finding I need the extra support. I love Ivan’s presentations by himself and his instructors.

Question about msg.sender. from an object oriented side of things is msg.sender an equivlent to the this keyword used in javascript?

Hey @blabtonic

Nope is not. You can view msg as a global variable, that has different properties.
One of these props is msg.sender.
The solidity docs refers to msg as special variable: https://docs.soliditylang.org/en/develop/units-and-global-variables.html?highlight=special%20variables%20and%20functions#special-variables-and-functions

Cheers,
Dani

1 Like

Hi Filip, I am a new student here and was thinking Solidity would be the language I want to learn, as it’s said to be most inherently made for blockchain. I only have basic html programming skills. Will that be enough to become competent in Solidity, or are there prerequisites I should look into before diving in to Solidity? Thanks for your help!

1 Like

Hey @loudogg

If you are new into programming and Solidity programming, I advice you to learn JavaScript first with our course, you will learn the fundamentals of JS that will help you understand quite easy the Solidity Syntax.

Carlos Z

1 Like

Ok cool, thanks @thecil, makes sense and will do!

1 Like

Really love the new improved solidity course guys!

2 Likes

what do each of these 2 return statements mean?

function getNumber() public view returns(int [] memory) {
return numbers;
}

Hello Tesh!
I hope you are having a fantastic day!
The first returns (returns(int[] memory)) specifies that when this function has doe its magic, it will spit out an array if type int and will be stored in the memory.

The second one (return numbers;) will do just that. somewhere in the function (that is not shown in your example) an array of int is defined with the name numbers, and now at the end of the function you are delivering on your promise to return an array of in as an output of the function.

hey everyone. I am kind of stuck in solidity 101. I am getting along well and following the tutorials exactly how Filip is saying however I keep getting an error on a portion of the code. I feel like I am missing something however I followed everything step by step so I am not sure. Here it is.

pragma solidity 0.5.12;

contract HelloWorld{
    
    string public message= "Hellow World";
    
    uint[] public numbers= [1, 20, 45];
    
    function getMessage()public view returns(string memory){
        return message;
    }
    
    functon setMessage(string memory newMessage) public {
        message = newMessage;
    }
    
    function getNumber(uint index) public view returns (uint) {
     return numbers[index];
    }



    function setNumber(uint newNumber, uint index ) public  {
    numbers[0]= 2;
}

        
        
        
    }

I am getting an error on line 13

Hi @Ernesto_Guidos

There is a typo in line 13 indeed.

You wrote functon should be function.

Cheers,
Dani

2 Likes