+ 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 Answers
+ 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