i1 = -1.1
i2 = 8.9
input1 = int(i1)
input2 = int(i2)
print "==== will print for food ===="
print " from "+str(input1)
print " up to "+str(input2)
print "============================="
print [y for y in range(input1, input2+1)]
==== will print for food ====
from -1
up to 8
========================
[-1, 0, 1, 2, 3, 4, 5, 6, 7, 8]
#include <iostream>
#include <functional>
template <typename T>
class defer {
private:
std::function<T()> mFunctor;
public:
defer(std::function<T()> functor) : mFunctor(functor) {}
~defer() { mFunctor(); }
};
int main() {
defer<void> d([] { std::cout << "Deferred func!" << std::endl; });
//...
std::cout << "Hello, world!" << std::endl;
if (true) {
return 0;
}
//...
if (false){
return 1;
}
return 0;
}