Digital FXtbook
Easy Contacts
  • Home
    • Free Software
    • The Author
    • Former Students Hall of Fame
    • A tribute....
  • Animation
    • Intro to 3d >
      • AutoDesk
      • Introduction: The Temple
      • Creating a Film >
        • Scriptwriting and Planning
        • StoryBoarding
        • Story Reels
      • Modeling >
        • The Nail
        • First Freestyle Lesson >
          • Cup and Straw
          • Garbage Can
        • Fence
        • Hammer
        • House
        • Environment Bubble
      • Animation >
        • Beginning Animation
        • Animation - Walk Cycle
        • Facial Animation
      • Rendering >
        • Arnold Rendering
      • Editing film >
        • Credits
        • Video Editing
      • Characters
    • Modeling and Rigging >
      • Modeling >
        • Image Planes
        • Polygon Modeling >
          • Coke Can
          • Low Polygon Character
          • Character Modeling Legion the Geth
          • Character Modeling Geth Armor
          • Face Modeling
        • NURBS Modeling >
          • Intro to NURBS
          • Lofting
          • CV Curves
          • Organic Modeling
          • Autombile
      • 3d Coat >
        • Integration with Maya >
          • Getting stuff out of Maya
        • UV Texture Mapping >
          • Texture mapping in 3d Coat
        • 3d Painting >
          • Painting in 3d Coat
        • Reintegration with Maya
      • Rigging >
        • Rigging with HumanIK
        • Smooth Skinning
      • Motion Capture
    • 3d Animation >
      • Arnold Rendering
      • Reference Videos
      • Beginning Animation
      • Characters
  • Gaming
    • Board Game Game Design Document
    • Modeling >
      • Introduction: The Temple
      • Halo 1 Blood Gulch Base
      • Hammer
      • Sword
      • Character Modeling Big Daddy
      • Shield
      • The OM6G
      • Weapon
      • Character Modeling Legion the Geth
      • Character Modeling Geth Armor
    • Animation >
      • Character Animation
    • Rigging >
      • Rigging with HumanIK
      • Characterizing and MoCap
      • Integration with Unity
    • Unity >
      • Block Breaker >
        • Block Breaker Game #1
        • Block Breaker Game #2
        • Block Breaker Game #3
        • Block Breaker Game #4
      • Terrain
      • Importing Models
  • Coding
    • Beginning C# >
      • First Unit >
        • First Program
        • Comments
        • PsuedoCode
        • Numbers and Operators
        • Use of Parenthesis
        • Casting
        • Try and Catch
        • Operators
      • Second Unit >
        • Conditional Statements >
          • Number validator
          • Number tester
          • Speed Camera
        • Random Class
        • Loops >
          • For Loops
          • For Each Loops
          • While Loops
          • Do While Loops
        • Arrays >
          • Simple Arrays
          • Complex Arrays
      • Third Unit
    • Intermediate C# >
      • Object Oriented Programming
  • Student Films
    • Advanced Student's movies
    • Beginning Student's movies
  • Adobe
    • Photoshop >
      • Introduction
      • Selection Tools >
        • Melonhead >
          • Melonhead Creative
        • Breakfast Lunch or Dinner
        • Blu 42
      • Painting Tools >
        • Invisi-World
        • Image Adjustment
        • FreeStyle project
      • Drawing Tools >
        • Abstract Expressionism
    • Premier >
      • Project 1
    • Illustrator >
      • Vector Ninjas
      • Live Art Painting
      • Starting the Pen Tool
      • Apple and Pear
      • Creating Your LOGO
      • Self Portrait
  • Links
    • Distance Reconnecting
    • Key Board Fix/Hack
    • Buiding Piers >
      • Buiding Piers
      • Buiding Piers
    • The Top Six Animation Schools
    • The Top Video Game Design Schools
  • International Team
  • BPA
    • BPA 2017-2018 >
      • Getting organized
      • Building the Train
      • Texturing the Train
      • Animating the Train
      • Making our Entry Film
    • BPA 2018-2019
    • BPA 2019-2020
  • Arnold Lighting
  • Faculty Video
  • Velomobile
  • CTE Summer Workshop

For Loop

   Every loops has a number pf the same basic elements in it. 
1. A beginning
2. 
An important block of code that needs to be run.
3. A testing condition or statement that judges whether or not to exit the loop.
​4. An end

A For loop changes the recipe from the While loop slightly. In the beginning of the For loop we initialize everything thing. I love this structure because it allows me to make sure that I am getting everything in the loop at the beginning so that I don't forget a piece later. It then runs along and treats the block of code as it own element.
Picture
Here is what the for loop looks like in code:
​

using System;
  
class forLoopDemo
{
    public static void Main()
    {
        for (int x = 1; x <= 4; x++)
            Console.WriteLine("DigitalfxtBook.com is amazing");
    }
}

Explanation of the code

So lets look at exactly what this code is doing:
1. We create our organization with the Class (forLoopDemo) and the Method (public static void Main())
​2. We then initialize the loop with three statements
     1. int x = 1 (this is our counter)
     2. x <= 4 (this is our condition testing to see if our loop has run for at least 4 times)
     3. x++ (this increments our counter up by one)
   Soooo in essence this one statement gets everything set up.
     The establishment of our counter only happens once.
     Every time the loop cycles through the test is run to make sure that the loop is going to happen one more time.
     At the end of the loop the counter gets incremented.
3. Now that the loop has been initialized we can run the important block of code inside of it.


Assignment

So in this lesson what you are going to create is:
1.
Write a program that picks a random number between 1 and 10.
2. Give the user 4 chances to guess the number.
3. If the user guesses the number, display “You won".
​4. Otherwise, display “You lost".

Here are some helpful hints to accomplish this lesson

1. Refresh your self with your knowledge of what is in the Random Class lesson. (this will allow you to create a Random number)
      Click Here to go to the Random class lesson
​2. Use an input statement like the one that you used in the Try and Catch lesson, to get numbers from your user. (Refresh your knowledge in the Try and Catch lesson)
      Click here to go to the Try and catch lesson. In this lesson we convert a string variable to a byte.
The better variable to use is an int. Here is a line of code to help you convert to int
     
var guess = Convert.ToInt32(Console.ReadLine());​
​
Proudly powered by Weebly