Do-while循环Java解释 [英] Do-while loop java explanation

查看:80
本文介绍了Do-while循环Java解释的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我没有在Java及其语法中获得do-while循环.有人可以解释一下吗?它是如何以各种形式编写的,其结构和语法是什么.

I do not get a do-while loop in java and the syntax of it. Can someone please explain it? How is it written in various forms, and what is its structure and syntax.

推荐答案

循环(检查然后执行)

while(condition_is_true) {

    // do something here

}

仅在给定条件为真时才执行此循环.很简单.首先检查.

This loop is executed only while the given condition is true. Simple enough. Checking first.

do {

    // do something here

} while (condition_is_true);

这将执行,然后检查条件是否为真.结果,这将至少循环一次.

This executes then it checks if the condition is true. As a result, this will loop at least once.

这篇关于Do-while循环Java解释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆