How to set a condition in a loop
up vote
0
down vote
favorite
fun main(args: Array<String>) {
val books = arrayListOf("farenheit 451", "1984", "Altered Carbon", "dark matter", "Le probleme à trois corps")
for (book in books) {
if (book.contains('e')) {
for(l in book){
println(l)
}
}
}
}
Hey guys, quick question this time,
what if i want to set a condition on the type of data ? as in it would only print the character of book that is of a certain type of data( int for exemple)
loops conditional conditional-types
New contributor
add a comment |
up vote
0
down vote
favorite
fun main(args: Array<String>) {
val books = arrayListOf("farenheit 451", "1984", "Altered Carbon", "dark matter", "Le probleme à trois corps")
for (book in books) {
if (book.contains('e')) {
for(l in book){
println(l)
}
}
}
}
Hey guys, quick question this time,
what if i want to set a condition on the type of data ? as in it would only print the character of book that is of a certain type of data( int for exemple)
loops conditional conditional-types
New contributor
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
fun main(args: Array<String>) {
val books = arrayListOf("farenheit 451", "1984", "Altered Carbon", "dark matter", "Le probleme à trois corps")
for (book in books) {
if (book.contains('e')) {
for(l in book){
println(l)
}
}
}
}
Hey guys, quick question this time,
what if i want to set a condition on the type of data ? as in it would only print the character of book that is of a certain type of data( int for exemple)
loops conditional conditional-types
New contributor
fun main(args: Array<String>) {
val books = arrayListOf("farenheit 451", "1984", "Altered Carbon", "dark matter", "Le probleme à trois corps")
for (book in books) {
if (book.contains('e')) {
for(l in book){
println(l)
}
}
}
}
Hey guys, quick question this time,
what if i want to set a condition on the type of data ? as in it would only print the character of book that is of a certain type of data( int for exemple)
loops conditional conditional-types
loops conditional conditional-types
New contributor
New contributor
New contributor
asked 2 days ago
mathieu
104
104
New contributor
New contributor
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
mathieu is a new contributor. Be nice, and check out our Code of Conduct.
mathieu is a new contributor. Be nice, and check out our Code of Conduct.
mathieu is a new contributor. Be nice, and check out our Code of Conduct.
mathieu is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53372876%2fhow-to-set-a-condition-in-a-loop%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown