CHAPTERFOUR
Be focused and you will archive alot. choose your ON C
Explore moreBe focused and you will archive alot. choose your ON C
Explore moreLorem ipsum dolor sit amet consectetur adipisicing elit. Hic odit rem dolorum molestiae fugit deserunt exercitationem recusandae, itaque ratione harum sit repellat dolor temporibus deleniti non voluptatem nostrum quas? Cumque veniam, molestias id natus pariatur dolores aut nemo iure facilis expedita, temporibus exercitationem ullam ex officiis reiciendis quaerat enim consequuntur.
in Programming, a comment is a programmer-readable explanaition or annotation in the source editor. comments are ignored by the compiler. in c# there are two ways of commenting:
in Programming, a comment is a programmer-readable explanaition or annotation in
the source editor. comments are ignored by the compiler. in c# there are two ways of commenting:
`` `
Using System.IO; Using System; class program{ static void Main(){ // this is a single line comment /* this is a multi line comment */ } }
Introduction to literals
this is a notation for representing a fixed value . in sinmple words , it is a value written as it is meant to be intepreted.
variable represents different values and a constant represents thesame value. A literal is the value itself.
Example: company = "onepercent"
the value onepercent is a literal
INTRODUCTION TO KEYWORDS:
leywords are predefined, reserved words used in Programming that have special meanings to the compiler
keywords are part of the syntax and they cannot be used as identifiers.
here are the list of keywords in c#: break, char, checked, continue, double, explicit, do, event, finally, foreach, in operator, private, ref, whort, struct, true, ulong, while.
TOKENS
a token is the smallest unit in a c# program which are meaningful to the compiler.
tokens are divided into 6 different types: keywords(example: if, int), identifiers(int quantity, price) etc
Introduction to operators
An operator is a symbol that operates on a value or a variable. for example. <#>+ is and operator to add numbers.
the types of operators that exist are: arithmetic, logic, increment/decrement, comparism, logical, assignment and bitwise operators.
INTRODUCTION TO ACCESS SPECIFIES.
acces specifiers are used for determining or setting the boundry for the availiability of class members outside its class.
access specifies are important to impliment data hiding
it is an important element of OOPS concepts
PUBLIC: all the class members declared under public will be availiable to everyone
PRIVATE: the class members declared as private can be accessed by the functions inside\ the class
PROTECTED: all the members declared as protected are inaccessible outside the class but can accessed by subclass of the class.
INTERNAL: the class members declared as internal are accessible by other functions and ] objects lying withing the assembly. assembly is the produced .dll or .exe from .NET Code
input and output
Console.WriteLine()
the Console.Writeline() is a method used to send formated output to the screen.
Any text within " " is printed as it is.
after, is where you specify the identifier who's value you would like to print. you can specify multiple values and it will be printed as in the index specified inside {}. the data would then be printed in the place of the {}.
Console.ReadLine()
the Console.ReadLine() is a method to accept input from the user.
Console.ReadLine() returns a value entered by the user and that value is then stored into a variable for later.
Using System; Using System.IO; namespace Sample{ class Test{ static void Main(string[] args){ int x = 12; int y; Console.Wriline("hello world"); Console.WriteLine("value of x is {0}", x); Console.WriteLine("Enter a value"); y = Console.Readline(); Console.WriteLine("value of y is {0}", y); } } }
output: hello world input: enter a value input: 15 output: value of is 15
a control statement is responsible for deciding which statement to execute (if statement)
it also decides the number of times a statement executes
examples:if, if else, else if ladder, nested if, switch case, while loop, do-while loop, for loop, nested loop;
if: simple if checks if a condition is true. it only executes if the condition is true.
syntax
if(condition){
code;
}
Using System; Using System.IO; namespace Mynamespace{ class Program{ static void Main(string[] args){ int age; int max = 12; Console.WriteLine("enter your age "); age = Console.ReadLine(); if (age == max){ Console.WriteLine("you can enter"){ } if(age>12){ Console.WriteLine("you cannot enter not for adults") } } } } }
output: enter your age input: 13 output: you cannot enter not for adults
vildash network team has had alot of impact on others but here are the vildash network team testimonies and expirience while working with the team
you can now connect and text other users from our database. you just neeed to click bellow to message them
WE HAVE CODE EDITORS FOR LANGUAGES LIKE C, C#, C++, HTML, CSS, javascript, JAVA VISUAL BASIC
We dont just teach you to code we teach you to code and build amazing systems.we are group of expert who wants to promote our field of studies