<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: yaswanth krishna</title>
    <description>The latest articles on Forem by yaswanth krishna (@yaswanth_krishna_81faee1e).</description>
    <link>https://forem.com/yaswanth_krishna_81faee1e</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2521799%2Fc36994b2-4680-484c-b64d-07104cfa7ef3.jpg</url>
      <title>Forem: yaswanth krishna</title>
      <link>https://forem.com/yaswanth_krishna_81faee1e</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/yaswanth_krishna_81faee1e"/>
    <language>en</language>
    <item>
      <title>Condition Rendering React</title>
      <dc:creator>yaswanth krishna</dc:creator>
      <pubDate>Mon, 27 Oct 2025 12:25:16 +0000</pubDate>
      <link>https://forem.com/yaswanth_krishna_81faee1e/condition-rendering-react-20ci</link>
      <guid>https://forem.com/yaswanth_krishna_81faee1e/condition-rendering-react-20ci</guid>
      <description>&lt;p&gt;&lt;em&gt;&lt;strong&gt;Condition Rendering ?&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Conditional rendering allows dynamic control over which UI elements or content are displayed based on specific conditions. It is commonly used in programming to show or hide elements depending on user input, data states, or system status. This technique improves user experience by ensuring that only relevant information is presented at a given time. It enables components to display different outputs depending on states or props. This ensures that the UI updates dynamically based on logic instead of manually manipulating the DOM.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;1. Using If/Else Statements&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If/else statements allow rendering different components based on conditions. This approach is useful for complex conditions.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwbompz7naomwek6g4c3i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwbompz7naomwek6g4c3i.png" alt=" " width="800" height="335"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;2. Using Ternary Operator&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The ternary operator (condition ? expr1: expr2) is a concise way to conditionally render JSX elements. It’s often used when the logic is simple and there are only two options to render.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmrinn2tuabqytzneyz0h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmrinn2tuabqytzneyz0h.png" alt=" " width="800" height="333"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function Greeting({ isLoggedIn }) {
    return &amp;lt;h1&amp;gt;{isLoggedIn ? "Welcome Back!" : "Please Sign In"}&amp;lt;/h1&amp;gt;;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;If isLoggedIn is true: Welcome Back!&lt;/li&gt;
&lt;li&gt;If isLoggedIn is false: Please Sign In&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;3. Using Logical AND (&amp;amp;&amp;amp;) Operator&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The &amp;amp;&amp;amp; operator returns the second operand if the first is true, and nothing if the first is false. This can be useful when you only want to render something when a condition is true.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function Notification({ hasNotifications }) {
    return &amp;lt;div&amp;gt;{hasNotifications &amp;amp;&amp;amp; &amp;lt;p&amp;gt;You have new notifications!&amp;lt;/p&amp;gt;}&amp;lt;/div&amp;gt;;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;If hasNotifications is true: You have new notifications!&lt;/li&gt;
&lt;li&gt;If hasNotifications is false: Nothing is rendered.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;4. Using Switch Case Statements&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Switch case statements are useful when you need to handle multiple conditions, which would otherwise require multiple if conditions. This approach can be more readable if there are many conditions to check.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcaxr2io518jtkeyuvgdg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcaxr2io518jtkeyuvgdg.png" alt=" " width="800" height="398"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function StatusMessage({ status }) {
    switch (status) {
        case 'loading':
            return &amp;lt;p&amp;gt;Loading...&amp;lt;/p&amp;gt;;
        case 'success':
            return &amp;lt;p&amp;gt;Data loaded successfully!&amp;lt;/p&amp;gt;;
        case 'error':
            return &amp;lt;p&amp;gt;Error loading data.&amp;lt;/p&amp;gt;;
        default:
            return &amp;lt;p&amp;gt;Unknown status&amp;lt;/p&amp;gt;;
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;If status is 'loading': Loading...&lt;/li&gt;
&lt;li&gt;If status is 'success': Data loaded successfully!&lt;/li&gt;
&lt;li&gt;If status is 'error': Error loading data.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;5. Conditional Rendering in Lists (Using .map())&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Conditional rendering can be helpful when rendering lists of items conditionally. You can filter or map over an array to selectively render components based on a condition.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const items = ["Apple", "Banana", "Cherry"];
const fruitList = items.map((item, index) =&amp;gt;
    item.includes("a") ? &amp;lt;p key={index}&amp;gt;{item}&amp;lt;/p&amp;gt; : null
);

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the item contains letter "a", it will be displayed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;6. Conditional Rendering with Component State&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You can also manage conditional rendering based on the component's state. For example, you can show a loading spinner until some data is fetched, and then display the actual content once the data is ready.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if (loading) {
  // Render Loading Component
} else {
  // Render Data Component
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>webdev</category>
      <category>programming</category>
      <category>vscode</category>
    </item>
    <item>
      <title>React Props ?</title>
      <dc:creator>yaswanth krishna</dc:creator>
      <pubDate>Mon, 27 Oct 2025 05:34:52 +0000</pubDate>
      <link>https://forem.com/yaswanth_krishna_81faee1e/react-props--57j9</link>
      <guid>https://forem.com/yaswanth_krishna_81faee1e/react-props--57j9</guid>
      <description>&lt;p&gt;&lt;strong&gt;Props Using in Reactjs&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;_In React (and similar frameworks like Vue or Svelte), props — short for properties — are a way to pass data from a parent component to a child component.&lt;/p&gt;

&lt;p&gt;Think of them like function arguments, but for components._&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conceptually&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Parent → Child communication&lt;/li&gt;
&lt;li&gt;Immutable inside the child (the child cannot change them)&lt;/li&gt;
&lt;li&gt;Allow components to be reusable and dynamic
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Parent Component
import Navbar from './assets/Navbar'
import Course from './Course'
import Footer from './Footer'


import './App.css';
import courseImg from './assets/1.jpg';
import coursesImg from './assets/2.jpg';
import coursessImg from './assets/3.jpg';
function App() {
  return (
    &amp;lt;&amp;gt;
      {/* &amp;lt;Navbar /&amp;gt; */}
      &amp;lt;Course name="HTML,Css" price="$100" image={courseImg} description="Html"  show={true}/&amp;gt;
      &amp;lt;Course name="JAVASCRIPT" price="$1100" image={coursesImg} description="javascript"show={true} /&amp;gt;
      &amp;lt;Course name="reactjs " price="$120" image={coursessImg} description="REactjs"show={true} /&amp;gt;


      {/* &amp;lt;Footer/&amp;gt; */}




    &amp;lt;/&amp;gt;
  );
}

export default App;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Child Component
import coursessImg from './assets/3.jpg'; 
 // 👈 Add this line at the top

function Course(props) {
    if (props.show==true)
    return (
        &amp;lt;div className="card"&amp;gt;
            &amp;lt;img src={props.image} alt="" /&amp;gt;
            &amp;lt;h4&amp;gt;{props.name}&amp;lt;/h4&amp;gt;
            &amp;lt;h5&amp;gt;{props.price}&amp;lt;/h5&amp;gt;
            &amp;lt;p&amp;gt;{props.description}&amp;lt;/p&amp;gt;
        &amp;lt;/div&amp;gt;
    );
}


export default Course;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here:&lt;/p&gt;

&lt;p&gt;_The parent  passes a prop called name with the value "Alice".&lt;/p&gt;

&lt;p&gt;The child  receives it through the props object and uses props.name._&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Using Destructuring (a common shorthand)&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function Greeting({ name }) {
  return &amp;lt;h1&amp;gt;Hello, {name}!&amp;lt;/h1&amp;gt;;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This does exactly the same thing — just cleaner.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7n4862ecrml1rys9o7y2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7n4862ecrml1rys9o7y2.png" alt=" " width="800" height="311"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>react</category>
      <category>beginners</category>
      <category>javascript</category>
    </item>
    <item>
      <title>React Key ?</title>
      <dc:creator>yaswanth krishna</dc:creator>
      <pubDate>Mon, 27 Oct 2025 05:27:03 +0000</pubDate>
      <link>https://forem.com/yaswanth_krishna_81faee1e/react-key-24p8</link>
      <guid>https://forem.com/yaswanth_krishna_81faee1e/react-key-24p8</guid>
      <description>&lt;p&gt;&lt;em&gt;&lt;strong&gt;React Key Feature ?&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;React is one of the most demanding JavaScript libraries because it is equipped with a ton of features which makes it faster and production-ready. Below are the few features of React.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Virtual DOM&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;React uses a Virtual DOM to optimize UI rendering. Instead of updating the entire real DOM directly, React:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Creates a lightweight copy of the DOM (Virtual DOM).&lt;/li&gt;
&lt;li&gt;Compares it with the previous version to detect changes (diffing).&lt;/li&gt;
&lt;li&gt;Updates only the changed parts in the actual DOM (reconciliation), improving performance.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. Component-Based Architecture&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;React follows a component-based approach, where the UI is broken down into reusable components. These components:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Can be functional or class-based.&lt;/li&gt;
&lt;li&gt;It allows code reusability, maintainability, and scalability.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. JSX (JavaScript XML)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;React usesJSX, a syntax extension that allows developers to write HTML inside JavaScript. JSX makes the code:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;More readable and expressive.&lt;/li&gt;
&lt;li&gt;Easier to understand and debug.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4. One-Way Data Binding&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;React uses one-way data binding, meaning data flows in a single direction from parent components to child components via props. This provides better control over data and helps maintain predictable behavior.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. State Management&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;React manages component state efficiently using the useState hook (for functional components) or this.state (for class components). State allows dynamic updates without reloading the page.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. React Hooks&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Hooks allow functional components to use state and lifecycle features without needing class components. Common hooks include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;useState: for managing local state.&lt;/li&gt;
&lt;li&gt;useEffect: for handling side effects like API calls.&lt;/li&gt;
&lt;li&gt;useContext: for global state management.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;7. React Router&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;React provides React Router for managing navigation in single-page applications (SPAs). It enables dynamic routing without requiring full-page reloads.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>vscode</category>
    </item>
    <item>
      <title>React Js</title>
      <dc:creator>yaswanth krishna</dc:creator>
      <pubDate>Mon, 27 Oct 2025 05:18:12 +0000</pubDate>
      <link>https://forem.com/yaswanth_krishna_81faee1e/react-oi5</link>
      <guid>https://forem.com/yaswanth_krishna_81faee1e/react-oi5</guid>
      <description>&lt;p&gt;What is Reactjs?&lt;/p&gt;

&lt;p&gt;ReactJS is a component-based JavaScript library used to build dynamic and interactive user interfaces. It simplifies the creation of single-page applications (SPAs) with a focus on performance and maintainability.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;import React from 'react': Imports React to create components and use JSX.&lt;/li&gt;
&lt;li&gt;function App() { ... }: Defines a functional component called App.&lt;/li&gt;
&lt;li&gt;return ( ... ): Returns JSX that represents the UI (a div with an h1 tag displaying "Hello, World!").&lt;/li&gt;
&lt;li&gt;export default App: Exports the App component so it can be used elsewhere.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;React Work ?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;React operates by creating an in-memory virtual DOM rather than directly manipulating the browser’s DOM. It performs necessary manipulations within this virtual representation before applying changes to the actual browser DOM.&lt;/p&gt;

&lt;p&gt;Here’s how the process works:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Actual DOM and Virtual DOM&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Initially, there is an Actual DOM(Real DOM) containing a div with two child elements: h1 and h2.&lt;/li&gt;
&lt;li&gt;React maintains a previous Virtual DOM to track the UI state before any updates.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. Detecting Changes&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When a change occurs (e.g., adding a new h3 element), React generates a New Virtual DOM.&lt;/li&gt;
&lt;li&gt;React compares the previous Virtual DOM with the New Virtual DOM using a process called reconciliation.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. Efficient DOM Update&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;React identifies the differences (in this case, the new h3 element).&lt;/li&gt;
&lt;li&gt;Instead of updating the entire DOM, React updates only the changed part in the New Actual DOM, making the update process more efficient.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>vscode</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>while using 1 to 25 looping statements</title>
      <dc:creator>yaswanth krishna</dc:creator>
      <pubDate>Mon, 03 Mar 2025 15:06:57 +0000</pubDate>
      <link>https://forem.com/yaswanth_krishna_81faee1e/while-using-1-to-25-looping-statements-1fmd</link>
      <guid>https://forem.com/yaswanth_krishna_81faee1e/while-using-1-to-25-looping-statements-1fmd</guid>
      <description>&lt;p&gt;1 to 25 print them while loop using statement?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package hlo;

public class upperlinit {

    public static void main(String[] args) {
//      int no=1;

//      while(no&amp;lt;=5) {
//          System.out.println(no);
//          no=no+1;
//          
//      }
//      while(no&amp;lt;=10) {
//          System.out.println(no);
//          no=no+1;
//          
//      }
//      while(no&amp;lt;=15) {
//          System.out.println(no);
//          no=no+1;
//          
//      }
//      while(no&amp;lt;=20) {
//          System.out.println(no);
//          no=no+1;
//          
//      }
//      while(no&amp;lt;=25) {
//          System.out.println(no+"");
//          no=no+1;
//          
//      }



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;it's using hard task you take easy method calfare next code i will explain.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package hlo;

public class upperlimit {

    public static void main(String[] args) {
int no=1;
        int upper_limit=25;
        while(upper_limit&amp;lt;=25) {
            while(no&amp;lt;=25) {
                System.out.println(no);
                no=no+1;
            }
            System.out.println();
            upper_limit=upper_limit+5;
        }

    }

}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;`output:&lt;br&gt;
1 2 3 4 5&lt;br&gt;
6 7 8 9 10&lt;br&gt;
11 12 13 14 15&lt;br&gt;
16 17 18 19 20&lt;br&gt;
21 22 23 24 25&lt;/p&gt;

&lt;p&gt;`&lt;/p&gt;

</description>
      <category>payilagam</category>
    </item>
    <item>
      <title>While looping understand counts how to work and 10101 while using concept</title>
      <dc:creator>yaswanth krishna</dc:creator>
      <pubDate>Mon, 03 Mar 2025 14:45:05 +0000</pubDate>
      <link>https://forem.com/yaswanth_krishna_81faee1e/while-looping-understand-counts-how-to-work-and-10101-while-using-concept-24jj</link>
      <guid>https://forem.com/yaswanth_krishna_81faee1e/while-looping-understand-counts-how-to-work-and-10101-while-using-concept-24jj</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package hlo;

public class while5times {

    public static void main(String[] args) {
int times=1;
while(times&amp;lt;=5) {


        int no = 1;
        int count = 1;
        while (count &amp;lt;= 5) {
            no = no - 1;
            System.out.println(no + "");
            if (count== 5)
                break;
            no=no+1;
            System.out.println(no + "");
            count=count+2;
        }
        times=times+1;
        System.out.println();
}

        }

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step-by-Step Execution&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Initial State
Variable    Value
no  1
count   1&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;First Iteration (count = 1, while condition true)&lt;/p&gt;

&lt;p&gt;no = no - 1; → 1 - 1 = 0&lt;br&gt;
System.out.println(no); → Prints 0&lt;br&gt;
if (count == 5) → count is 1, so break does not execute&lt;br&gt;
no = no + 1; → 0 + 1 = 1&lt;br&gt;
System.out.println(no); → Prints 1&lt;br&gt;
count = count + 2; → 1 + 2 = 3&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Second Iteration (count = 3, while condition true)&lt;/p&gt;

&lt;p&gt;no = no - 1; → 1 - 1 = 0&lt;br&gt;
System.out.println(no); → Prints 0&lt;br&gt;
if (count == 5) → count is 3, so break does not execute&lt;br&gt;
no = no + 1; → 0 + 1 = 1&lt;br&gt;
System.out.println(no); → Prints 1&lt;br&gt;
count = count + 2; → 3 + 2 = 5&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Third Iteration (count = 5, while condition true)&lt;/p&gt;

&lt;p&gt;no = no - 1; → 1 - 1 = 0&lt;br&gt;
System.out.println(no); → Prints 0&lt;br&gt;
if (count == 5) → Yes! break executes&lt;br&gt;
The while loop terminates.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Additional Explanation&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;The value of no keeps alternating between 0, 1, 0, 1, 0.
The value of count increases as 1 → 3 → 5.
When count becomes 5, the break statement stops the loop.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;`output:&lt;/p&gt;

&lt;p&gt;10101&lt;br&gt;
`&lt;/p&gt;

</description>
      <category>payilagam</category>
    </item>
    <item>
      <title>Thenali raman Story "logical thinking in Java"</title>
      <dc:creator>yaswanth krishna</dc:creator>
      <pubDate>Mon, 24 Feb 2025 19:18:21 +0000</pubDate>
      <link>https://forem.com/yaswanth_krishna_81faee1e/thenali-raman-story-logical-thinking-i-java-36oc</link>
      <guid>https://forem.com/yaswanth_krishna_81faee1e/thenali-raman-story-logical-thinking-i-java-36oc</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package hlo;

public class While {
    public static void main(String[]args) {
        int thenali=1024;
        int solider=thenali-1;
        int count=0;
        while(solider&amp;gt;=1) {
            solider=solider/2;
            count=count+1;
        }

        System.out.println(count);

        }

    }





&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;output:&lt;br&gt;
10&lt;/code&gt;&lt;/p&gt;

</description>
      <category>java</category>
      <category>programming</category>
      <category>howto</category>
    </item>
    <item>
      <title>police thief while using "logical thinking"</title>
      <dc:creator>yaswanth krishna</dc:creator>
      <pubDate>Mon, 24 Feb 2025 19:05:53 +0000</pubDate>
      <link>https://forem.com/yaswanth_krishna_81faee1e/police-thief-while-using-logical-thinking-4ipl</link>
      <guid>https://forem.com/yaswanth_krishna_81faee1e/police-thief-while-using-logical-thinking-4ipl</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package hlo;

public class While {
    public static void main(String[]args) {
        int police=0;
        int thief=40;
        while(police&amp;lt;40) {
            police=police+5;
            thief=thief+2;
        }
        System.out.println(police);

        }

    }





&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;output:&lt;br&gt;
      40&lt;/code&gt;&lt;/p&gt;

</description>
      <category>java</category>
      <category>programming</category>
    </item>
    <item>
      <title>python using Eb bill basic</title>
      <dc:creator>yaswanth krishna</dc:creator>
      <pubDate>Mon, 24 Feb 2025 19:00:12 +0000</pubDate>
      <link>https://forem.com/yaswanth_krishna_81faee1e/python-using-eb-bill-basic-8f9</link>
      <guid>https://forem.com/yaswanth_krishna_81faee1e/python-using-eb-bill-basic-8f9</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;units = int(input("Enter the total number of units: "))  

if units &amp;lt;= 100:
    bill = 0  
elif units &amp;lt;= 200:
    bill = (units - 100) * 2  
elif units &amp;lt;= 500:
    bill = (100 * 2) + (units - 200) * 5  
else:
    bill = (100 * 2) + (300 * 5) + (units - 500) * 8  

print(" Electricity Bill Amount: {bill})  

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;output:&lt;br&gt;
Enter the total number of units: 5000&lt;br&gt;
 Electricity Bill Amount: ₹37700&lt;/code&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>payilagam</category>
    </item>
    <item>
      <title>While Loop Basics</title>
      <dc:creator>yaswanth krishna</dc:creator>
      <pubDate>Mon, 24 Feb 2025 14:13:02 +0000</pubDate>
      <link>https://forem.com/yaswanth_krishna_81faee1e/while-loop-basics-50b3</link>
      <guid>https://forem.com/yaswanth_krishna_81faee1e/while-loop-basics-50b3</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package hlo;

public class While {
    public static void main(String[]args) {
        int no=7;
    int count=1;               // 7=7+3=10 10=10-2=8
        while(count&amp;lt;=3) {
             no=no+3;
             System.out.print(no+ "   " );
             no=no-2;
             System.out.print(no+ "   " );
             count=count+1;



        }

    }

}
//Explanation:
//This is a simple alternating addition and subtraction series. In the first pattern, 3 is added; in the second, 2 is subtracted.
//Look at this series: 7, 10, 8, 11, 9, 12, ... What number should come next?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;Output:&lt;br&gt;
10   8   11   9   12   10&lt;/code&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  why use count?
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;You're wondering if the count variable, that is incremented as count = count + 1, can be changed to increase by 2 (count = count + 2), or if we could use subtraction, multiplication, or division within the while loop.&lt;br&gt;
Answer:&lt;br&gt;
Yes, you may change count in any way you want.&lt;br&gt;
If you set count = count + 2, the loop will execute half as often because count is incremented by 2 rather than by 1.&lt;br&gt;
If you use count = count - 1, the loop may never end (infinite loop) if you do not establish proper conditions.&lt;br&gt;
If you use multiplication (count = count * 2), the loop will expand exponentially and terminate long before.&lt;br&gt;
If you use division (count = count / 2), the value will reduce, and based on the condition, it may never meet the stopping criteria or stop prematurely.&lt;br&gt;
The idea is to reduce count cautiously in relation to the number of times you wish to repeat the loop.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>java</category>
      <category>payilagam</category>
    </item>
    <item>
      <title>While Loop Basics</title>
      <dc:creator>yaswanth krishna</dc:creator>
      <pubDate>Mon, 24 Feb 2025 13:24:01 +0000</pubDate>
      <link>https://forem.com/yaswanth_krishna_81faee1e/while-loop-basics-371n</link>
      <guid>https://forem.com/yaswanth_krishna_81faee1e/while-loop-basics-371n</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package hlo;

public class While {
    public static void main(String[]args) {
        int no=4;
    int count=4;
        while(no&amp;lt;=100) {

            System.out.println(no);
            no=no*4;
             count=count+4;
             System.out.println(count);
        }

    }

}
 output:16 12 64 16
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>java</category>
      <category>payilagam</category>
    </item>
    <item>
      <title>While Loop Basics</title>
      <dc:creator>yaswanth krishna</dc:creator>
      <pubDate>Mon, 24 Feb 2025 12:54:41 +0000</pubDate>
      <link>https://forem.com/yaswanth_krishna_81faee1e/while-loop-basics-5n3</link>
      <guid>https://forem.com/yaswanth_krishna_81faee1e/while-loop-basics-5n3</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package hlo;

public class While {
    public static void main(String[]args) {
        int no=2;

          //0  //2 //5
----------&amp;gt;  while(no&amp;lt;=5) {
    "From 2 to 5, inclusive, anything less than or equal to."
            System.out.println(no);
            no=no+1; //2=2+1 =3
                                 // 3=3+1=4
                                 // 4=4+1=5
        }

    }

}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>java</category>
      <category>payilagam</category>
    </item>
  </channel>
</rss>
