while and if statements | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 1

while and if statements

how do i put "If" statement in a "while" statement? im new

1st Nov 2022, 11:11 PM
Evann Elmore
Evann Elmore - avatar
2 Réponses
+ 5
Like This :- while ( [condition] ) { if ( [condition] ) { } }
2nd Nov 2022, 12:11 AM
Aditya Dhiman
Aditya Dhiman - avatar
+ 1
Just as you put any statement in the main function: you write it within the statement body - that is between the curly braces { }
1st Nov 2022, 11:30 PM
Nick