I find it confusing that the types come before the name for variables and after the name for functions...
That looks like the return value, similar to how it's done in rust, what goes in the function is on the left, what comes out of the function is on the right.
In Rust the type is on the right in both variables and the return:
name type | name type | | | | | V V V V fn foo(x: i32) -> i32
In C, the type is on the left for both the variables and the function (though one can argue that the arguments are also part of the function's type):
type name | | type name | | | | V V V V int foo(int x)
In this syntax the order is sometimes type...name and sometimes name...type:
name type | type name | | | | | V V V V foo(Int x) -> Int
AH, yes you're right, I missed what you were specifically talking about.
did you make the illustration by hands? or there is some tools can do this
Just use a monospace font - any programming-oriented text editor will do.
The type is on the left when it's required and on the right when it's optional
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I find it confusing that the types come before the name for variables and after the name for functions...
That looks like the return value, similar to how it's done in rust, what goes in the function is on the left, what comes out of the function is on the right.
In Rust the type is on the right in both variables and the return:
In C, the type is on the left for both the variables and the function (though one can argue that the arguments are also part of the function's type):
In this syntax the order is sometimes type...name and sometimes name...type:
AH, yes you're right, I missed what you were specifically talking about.
did you make the illustration by hands? or there is some tools can do this
Just use a monospace font - any programming-oriented text editor will do.
The type is on the left when it's required and on the right when it's optional