Hello and welcome to the goal and programming language course.
In this session, we want to talk about create an example for lead and ride the fine and go language.
In this sample, the user is supposed to receive information from the council and save the received
information inside the file and then read the information is stored inside the file and display it.
Now let's go to this school for a year to read and write the fine.
First, create a function named create fine for creative fine and write data inside it.
In this function, we defined two parameters pass file name and find content.
So define
foreign.
Create five set two parameters first, find the.
And second, text and type of there is a strike.
Creating the file using create function, which user interrupted fine name and or variable so defined
by comma here equals in create fun from Westpac case or start, create fine and set file name.
Now we check to print a message for us if the error is not empty, so right, if error not equals to
mean.
Colin Fatalis from launch function last Saturday, left and right, a message failed to create five
column percentages and set a rule value about.
Now, closing the running fine after the main method has completed the execution and the writing to
the file is complete.
So views from different keyboard differ and close the font file close.
Now writing data to the using write history, so first define tool variable.
First, Len and Edward Cullen equals fine dot.
Write a string.
And it takes.
As our humans now we take to create a message for us, if the error is not empty, if a row not equals
to mean so fat on Earth, from large package life to fatal Earth and Saturn message hail
writing
to fire color, cursing Earth and such error message.
Now print name and lengths of function by following code.
If bank is less than five, nine per cent is set by that name.
If if.
I guess less and less.
Colin, persons since the Whites said, Len, very.
Reformat the code, then save the project, we were able to create a function that receives two parameters
can't find a name and file content as takes from the outside, then creates the desired file and is
supposed to receive information inside the phone.
Now we want to create the function to read and display the information is stored and defined.
First, create a function name, Redefine and set the parameters fine name, phone.
Read fine and set a parameter name by name as a stream.
Display a message based on reading fine information.
The fear that is less and reading the.
To read data from DeFi, the use redefine function of AI or UTIL package redefine function reads the
fine named by file name and returns the contents.
This function returns to variables as bias area, and they're also first defined to variable like data
and URL column equals.
Invoke redefined function from AI to take each dot read fine.
And sit fine, Amos arguements fine name in case of an error, the erroneous statement is printed and
program is a start, so we'll be right if are not equal to mean.
We use from panic, a function from like package locked door punch if and set a message, fail.
Reading data from five columns per cent is an said error of value that.
In this case, we display fine line lengths of fine and fine contents by the following code.
Defensive back slash and fine name calling.
Yes, and set fire and then variable.
If Earth patches list and size per cent the ice and set then of data.
Variable and back, yes, list and data.
Colin Person is said data, right?
Reformat the code and save the project.
Now we were able to create the function that receives defined name as an input parameter and then reads
the information inside the received file and display it.
Now we can create two functions one function to create the fine and save the information inside it and
the other function to read the existing information from the fire.
It's time for the user to receive information from the council inside the main function and to write
and read the information by calling the functions created in the main method.
So go to main function.
User input for finding the first display, a message to let the user know that they need to enter information
FP into by name
and define a variable for assigned file name to it by using its own function.
First, define the variable like that file name type is a string and define 2.0 scanlon and set and
person file name.
Now, using input for five content, we do this again.
First display a message to let the user know that they need to enter information, so write F.P. into
text
to read information from the council.
We use for a new reader function that returns in new reader, whose buffer has the default size and
assign it to a variable like input reader input reader.
Column equals invokes new reader function from both I or package, while I o but new reader and sit
a standard input as argued or stored listed in now.
Views from reader soon function for reading the text reader string function reads until the first occurrence
of delimiter in the input returning Estyn containing date data up to and including the delimiter.
If we string encounters an error before finding a delimiter, it retains the date on read before the
error and error itself.
So first, define the variable like improved chrome on a school call.
It equals input reader
dot reader string.
We set a delimiter for the example backslash and either able to receive the information from the outside
environment.
Now we have to write and read and display it again to their to existing functions inside, define first
involved, create file function and post two variables file name as foreign name and input as file content
to either create fine first, finally and second input.
Then invoke redefine function and pacifying them as argument to fetch data from five fold, we write,
read fine and certified nay, reformat the code, save the project and execute the program.
Inter Define, named for the example, test the RTX three.
Initiatives.
Hello and welcome to go programming.
Language
now we can see the output file name is pierced, the text length is 46 bytes reading a fine and then
again fine, then test.
The text size is for six bytes and data.
Please.
Hello and welcome to go programming language.
We were able to get the information from the console right, eat in the phone and then read the information
from the file and display it in order not to prolong the time of decision to will finish it, and we
will continue the content in the next session.
Goodbye.