• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

else if

 
Ranch Hand
Posts: 278
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
in K& B ,
chap 5 page 318,flow control -if else statements.
i just want to confirm one thing.
in book ,in an example ,hry say
if(cond){}
else{ if(){...}} //this form of else{if} is just an example
else..

then else {if()} can be replaced with else if .
i believe this former method is just an example of need of else-if,
not a valid syntax as two else's cant be there.
I have nt seen anywhere else ,and also tried it.
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Lucky J Verma:
...i believe this former method is just an example of need of else-if,
not a valid syntax as two else's cant be there...


The syntax in the book is valid. Although if you look carefully, you will see it's slightly different than what you've posted.

(Indentation helps to see the differences in these examples. Please use Code Tags when posting indentation.)
 
Lucky J Verma
Ranch Hand
Posts: 278
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
oh i got it ...thanks a lot
 
It's a tiny ad only because the water is so cold.
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic