Hello and welcome to the Golang programming language course.
In the previous session, we talked about spirit after and mastering and indecision.
We want to talk about the other's strengths concept.
Compare extremes in Golang.
No language, this ring is an immutable chain of arbitrary bias encoded UTF eight encoding, you are
allowed to compare extremes with each other using different face, fierce competition operators and
the other compare method.
Using competition operators go with string supports conversion operators i.e. equals two not equals
to greater than equal to less than equal to greater than and less than.
Here the equals two and not equals to operate or are used to check if the given streams are equal or
not and greater than equal to and less than equal to greater than and than operators are used to find
the lexical order.
The results of these operators are of Boolean type, meaning if the condition is satisfied, it will
return to otherwise return false.
Now let's go to this school program to illustrate the concept of equals two and not equals to operate
or meet strings.
First, creating an initializing for listing variables, using shorthand declaration for the example,
the first the one calling equals go that first characters offer this, and if they are to call an equals,
go that all characters are uppercase and three equals Golang and just three or four equals.
Go like first variable now checking the string are equal or not using equals to operator and assign
resolve to a variable.
For the example, check is your home and if your are and assign value to resolve one.
So define variable result from column equals is still the one equal to SDR to.
Now we make a few more conversions for the example SDR to end SDR three.
So define a variable right result to column equals SDR to equal to SDR three.
And resolved three Colleen Equals is TR three, not to be cool, to see are full and resolved for Cullen
equals another conversion.
Or one equal equal to this, the are full now display the result variables FP.
Result one, Colin and I set variable result one.
It returns a Boolean value FP resolved to.
Colin sits resolved to.
And right, for the other variables he resolved.
Three Colin Smith resolved.
Three.
And this be resolved for Colin and set by the end result for Reform article.
Save the projects and execute the program.
Now we can see the output result volume and the to fast and resolve to the end result for these two.
We could compete for racing very well together by the equal two and not equal to operators and see the
results.
OK, now go to a slice and continue second v using confirm it would.
You can also compare it to other things using the built in function compare provided by this package.
Now you can see the scene tax.
This function returns an integer value after competing two strings in terms of vocabulary.
The return values are returns zero if SDR want equal to SDR to return one if SDR one greeter, then
is the R2 and return minus swan if SDR one less than SDR to.
Now let's go to a school program to illustrate how to compare a string using compare function.
First, clear, the last court.
So, right, if the.
Festering, Speck H.
Dot com paid fonctionne that it acts it to arguements as a and B and type of them.
So select counter and sit variable or value of instant like hello and set to value.
Like what?
And do another conversion that to things are similar together, like FP Mistress Package dot com per
function and set to variable like together, go blank and go blank and do another conversion that to
a string are the same, except that the first letter of the first string is thought to be the largest
character, and the first letter of the second is string a source with the uppercase character.
So right, if the
strings package and involved the column, her function and set value for first variable go blank and
set value for second argument like go blank, reformat the code, save the project and execute the program.
Now we can see the output for first comparison, we have minus one value and four second zero value
and four third conversion, and we have one value.
So we could compare two variables by comp or function and get into resolved in order not to prolong
the time of decision to be finished, and we will continue to contend in the next session.
Goodbye.