+ 2
Can i use the if statement inside a function?
i need to create a function that return the number of digits that have an int.
7 Respostas
- 2
As others have mentioned it is perfectly fine to use if statements inside a function. If you're looking for an example I've created following script: https://code.sololearn.com/c6F97sc4NgGU
Taking a number as input, if the number is above 5 it will output True(1), else False(0).
+ 12
ofcouse you can use
+ 1
Yes, you can.
+ 1
You're only able to use if statements in functions, so of course you can!
+ 1
Of course you can! Heres an example I just made up
void thisFunction(int a){
if(a<18){
cout<<"sorry 18+ only"<<endl;
}
else{
cout<<"welcome"<<endl;
}
}
int main(){
int a = 16;
void thisFunction(a);
return 0;
}
0
ofcos yes...can be used